LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-09-2011, 12:54 PM   #1
city83
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Rep: Reputation: Disabled
Creating a directory


Hello I am wondering if its possible to create music and work directory in a single command under opt. I understand you can do there a way when you can create music and work in a single command? Thank You
cd backup/opt/videos
mkdir music
mkdir work
Is there a way when you can create music and work in a single command? Thank You
The picture is below
http://img685.imageshack.us/img685/8939/treekk.png
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-09-2011, 03:40 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by city83 View Post
Hello I am wondering if its possible to create music and work directory in a single command under opt. I understand you can do there a way when you can create music and work in a single command? Thank You
cd backup/opt/videos
mkdir music
mkdir work
Is there a way when you can create music and work in a single command?
your description is a bit confusing, but I guess you're looking for the -p switch for mkdir:

Code:
mkdir -p /a/b/b/d
That creates the directory .../d and also the chain /a/b/c if it doesn't already exist.

[X] Doc CPU
 
1 members found this post helpful.
Old 10-09-2011, 03:44 PM   #3
city83
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doc CPU View Post
Hi there,



your description is a bit confusing, but I guess you're looking for the -p switch for mkdir:

Code:
mkdir -p /a/b/b/d
That creates the directory .../d and also the chain /a/b/c if it doesn't already exist.

[X] Doc CPU
Yes, I didn't use the -p or the { }. I already figured it out though, the command was mkdir -p videos/{music,work}. Thank You though!
 
Old 10-09-2011, 03:49 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
At first, /opt is not the place were directories like that belong, at least if you keep up to the FHS.

But anyways, to create many subfolders in a single directory you can use the curly braces, for example to create the folders video and work in your home-directory you can use:
Code:
mkdir ~/{video,work}
 
2 members found this post helpful.
Old 10-09-2011, 03:55 PM   #5
city83
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by TobiSGD View Post
At first, /opt is not the place were directories like that belong, at least if you keep up to the FHS.

But anyways, to create many subfolders in a single directory you can use the curly braces, for example to create the folders video and work in your home-directory you can use:
Code:
mkdir ~/{video,work}
Thank You, for this! This was just what I needed!
 
  


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
[SOLVED] Creating a directory structure. Tayuechick Linux - Newbie 5 05-16-2010 09:33 AM
Useradd not creating home directory when creating newuser meneedham Linux - Newbie 4 10-05-2007 01:11 PM
creating home directory jitheshmurali Linux - Networking 2 04-24-2006 07:03 AM
Advice on creating new directory satimis Linux From Scratch 4 06-27-2005 09:34 PM
Creating a login for a directory Renaxgade Linux - Software 2 10-18-2003 01:16 AM


All times are GMT -5. The time now is 03:29 AM.

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