LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-15-2012, 09:43 PM   #1
missy1234eva
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Rep: Reputation: Disabled
Smile 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!!

Last edited by missy1234eva; 08-15-2012 at 09:45 PM.
 
Old 08-15-2012, 09:49 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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"
 
1 members found this post helpful.
Old 08-15-2012, 09:52 PM   #3
missy1234eva
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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).
 
Old 08-15-2012, 09:54 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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?
 
Old 08-15-2012, 09:59 PM   #5
missy1234eva
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-15-2012, 10:04 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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?
 
1 members found this post helpful.
Old 08-15-2012, 10:05 PM   #7
missy1234eva
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Okay, gotcha now!!! Well, I am using Fedora. Is this what you mean?

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

Last edited by missy1234eva; 08-15-2012 at 10:06 PM.
 
Old 08-15-2012, 10:06 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
See my last post----you might have missed it while typing.
 
Old 08-15-2012, 10:07 PM   #9
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
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.
 
1 members found this post helpful.
Old 08-16-2012, 02:23 AM   #10
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 222

Rep: Reputation: 52
and then there is a cd command which allows you to change directory into for example your newly created one.
 
Old 08-16-2012, 02:53 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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.

Last edited by jschiwal; 08-16-2012 at 02:55 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Take part of a Linux command line from a file eddyq Programming 9 01-14-2012 02:12 AM
command to write on first line of a file (as a heading for columns) in linux/solaris. Sha_unix Linux - Newbie 9 11-23-2011 03:14 PM
macos-like command line file viewer (open) in linux shunker Linux - Newbie 0 12-25-2003 08:21 AM
linux file structures exigent Linux - General 3 08-17-2002 03:45 AM


All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration