Linux command Line help about file structures.
Hello, I am just starting with Linux command line.
I have a few questions. How would I make a hierarchical directory under /root that consists of one directory containing three subdirectories? What would the command line be? And, once this is done, what would the command line be to copy two files into each sub directory? And, how would I then create another directory with three subdirectories beneath it and move files from the subdirectories containing them to the counterparts you just created? Thanks a lot in advance!! :) |
Homework---right?
Please tell us what you are studying---what commands you have learned, etc. On a Linux system, open a terminal and enter: "man mkdir" (no quotes). After you have read that, then enter "man cp" |
Hi, thanks for your reply. I am studying Linux+ Guide to Linux Certification. I finished the required part. But, this is part of the discovery exercise, which is non-graded. I only know very basic things like mkdir, cp, mv, cd, ln, touch, mkdir..etc (very basic ones).
|
OK---if you know mkdir, then you know how to make the directories.
What version of Linux are you using? Can you go into your home folder directory and create a new directory there?---if so, then can you cd into the new directory and make another one there? |
Okay, so, the first part I can make a directory: mkdir dirname
And then, to create three subdirectories? I haven't done that. I only know how to use the command line. I think I'm getting this. Oh, I am using Linux Fedora. |
If you know how to create a directory, then you know how to create a sub-directory-----they are the same thing!!
As I suggested in my previous reply, do this: cd to your home directory mkdir directory_1 now, cd to that new directory, and use mkdir to create another directory. And--once again---what version of Linux are you using? |
Okay, gotcha now!!! Well, I am using Fedora. Is this what you mean?
But yeah, I understand it now :) Thanks for your help! |
See my last post----you might have missed it while typing.
|
Hi,
here are some hints: - mkdir can take multiple arguments: mkdir a b - mkdir understands what "/" means: mkdir a/b - Have a look at -p option in the mkdir man page Evo2. |
and then there is a cd command which allows you to change directory into for example your newly created one.
|
You can create all four directories in one command:
mkdir -p dir1/{dir1,dir2,dir3} Look up brace expansion in the bash info manual. It is very handy at generating sequential arguments. |
All times are GMT -5. The time now is 07:30 AM. |