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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-15-2012, 08:43 PM
|
#1
|
LQ Newbie
Registered: Aug 2012
Posts: 4
Rep:
|
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 08:45 PM.
|
|
|
08-15-2012, 08:49 PM
|
#2
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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.
|
08-15-2012, 08:52 PM
|
#3
|
LQ Newbie
Registered: Aug 2012
Posts: 4
Original Poster
Rep:
|
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).
|
|
|
08-15-2012, 08:54 PM
|
#4
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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?
|
|
|
08-15-2012, 08:59 PM
|
#5
|
LQ Newbie
Registered: Aug 2012
Posts: 4
Original Poster
Rep:
|
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.
|
|
|
08-15-2012, 09:04 PM
|
#6
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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.
|
08-15-2012, 09:05 PM
|
#7
|
LQ Newbie
Registered: Aug 2012
Posts: 4
Original Poster
Rep:
|
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 09:06 PM.
|
|
|
08-15-2012, 09:06 PM
|
#8
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
See my last post----you might have missed it while typing.
|
|
|
08-15-2012, 09:07 PM
|
#9
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
08-16-2012, 01:23 AM
|
#10
|
Member
Registered: Jul 2004
Distribution: slackware
Posts: 225
Rep:
|
and then there is a cd command which allows you to change directory into for example your newly created one.
|
|
|
08-16-2012, 01:53 AM
|
#11
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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 01:55 AM.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 03:25 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|