LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux command Line help about file structures. (https://www.linuxquestions.org/questions/linux-newbie-8/linux-command-line-help-about-file-structures-4175422300/)

missy1234eva 08-15-2012 08:43 PM

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!! :)

pixellany 08-15-2012 08:49 PM

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"

missy1234eva 08-15-2012 08:52 PM

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).

pixellany 08-15-2012 08:54 PM

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?

missy1234eva 08-15-2012 08:59 PM

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.

pixellany 08-15-2012 09:04 PM

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?

missy1234eva 08-15-2012 09:05 PM

Okay, gotcha now!!! Well, I am using Fedora. Is this what you mean?

But yeah, I understand it now :) Thanks for your help!

pixellany 08-15-2012 09:06 PM

See my last post----you might have missed it while typing.

evo2 08-15-2012 09:07 PM

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.

wigry 08-16-2012 01:23 AM

and then there is a cd command which allows you to change directory into for example your newly created one.

jschiwal 08-16-2012 01:53 AM

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.