Linux Terminal: Create directory and subdirectories command [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I a little bit confused..
if in case i don't have any directory
and then I want to make a new directory with subdirectories
for example I want to make a directory named A and subdirectories B and C
can I directly use :
mkdir -p A/B A/C
or must I use
mkdir -p A A/B A/C
which is the right one?
Thank you

As mentioned in my comment, -p tells mkdir to create the parent directory/ies if it does not exist. So in your case A is created when the subdirectory is created.
Therefore:
mkdir -p A/B A/C

Related

Convert file or directory to symbolic link and preserve permissions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have /home/eric/public_html with drwxr-x--- eric:nobody as the mod and ownership.
I login with eric so I cannot recreate this folder without root access, since eric is not part of the nobody group.
I want to replace my public_html with a symbolic link (i.e. ln -s ~/git/project/src ~/public_html) but if I do that, my new public_html ends us without the correct permissions.
Is there a trick to get around this without contacting my admin?
Possibly by doing the following:
Copy everything from ~/git/project/src into ~/public_html
mv ~/git/project/src ~/git/project/src2 to get it out of the way
mv ~/public_html ~/git/project/src
finally link it back: ln -s ~/git/project/src ~/public_html
The idea is to keep the original public_html directory because it has the correct owner/permissions, but reuse it as the link target.

How can i symlink home directory in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have my home directory in /home/tom.
In another partition I have a folder called /data/tomhome.
Basically, I copy all of my data from /data/tomhome to /home/tom
But whenever I update files in /data/tomhome, I still have to copy them to the other directory.
Another way will be to symlink all files but i don't want to make 20 symlinks.
Is there any other way for this?
Try
ln -s /home/tom /data/tomhome
Note: You should delete the directory /data/tomhome with rm -rf /data/tomhome if it exists already

Running chmod command as root with "." [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Line#1 pwd
Line#2 /Users/jigarnaik/Documents/test
Line#3 sh-3.2# chown -R jigarnaik .
What will be the effect of line no 3 ?
Will it change owner of the entire device in linux OS OR
the current folder and it's sub-folders OR
all the folders and files in the path given ?
I ran the command as root
It will change the owner of the current directory and all subdirectories.

-a option in `cp` command -- what does it do? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
What does the -a option do in the cp command?
I thought that the -a does not preserve the structure of directories. But, I have never found a case where the structure of directories has been destroyed by the -a option.
is there such a case where the structure of directories has been destroyed by the -a option? Thanks.
-a means 3 things:
preserve timestamps, permissions, group, user (if you're running as root).
preserves symbolic links (no dereference)
recursive copy
read the man page, it has all info there
-a, --archive
same as -dR --preserve=all
To my understanding, it should recursively copy the directories while keeping all the attributes. In which case, it shouldn't be destroying the structure at all.
http://man7.org/linux/man-pages/man1/cp.1.html

Is it possible to create more than one directory on a same command? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I took an examination last week and there was a question asking to create three directories by using one command ; then there was a question asking to delete those directories on a same command. Is that possible ?
You should read man mkdir and man rm
mkdir -pv myfolder/{a..z}/{1..10}
creates 261 folders (myfolder/a/1, myfolder/a/2.... myfolder/z/10)
rm -rf myfolder/
removes them all
Yes this is possible.
Check here and here
Removing directories in one command is also possible. Check here

Resources