LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-30-2015, 08:02 AM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Rep: Reputation: 29
how to use mkdir -p


hi guys

trying to make a parent directory using mkdir -p
but it doesnt seem to work,just creates in the same directory

i tried
mkdir -p parenttest foldertest
this just created 2 folders in current
can somebody explain
man pages for mkdir just have -p create parent (but doesnt
explain usage)

tried googling...couldnt find usage...thanks
 
Old 07-30-2015, 08:04 AM   #2
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Original Poster
Rep: Reputation: 29
no thought i had it...dont really understand how this works.

Last edited by sigint-ninja; 07-30-2015 at 08:08 AM.
 
Old 07-30-2015, 08:40 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
The correct syntax is:

mkdir -p /parent/folder_test.

If parent does not already exist it will be created. You can also use relative paths i.e.

mkdir -p parent/folder_test

If your current working directory is your home (/home/username) then the above command would create a directory tree /home/username/parent/folder_test

Last edited by michaelk; 07-30-2015 at 08:44 AM.
 
Old 07-30-2015, 12:18 PM   #4
ajaycentos
LQ Newbie
 
Registered: Jul 2015
Distribution: ubuntu centos
Posts: 1

Rep: Reputation: Disabled
Correct Syntax is mkdir -p foldername1/foldername2.

Remember there is no space between the foldernames. Need to use /.
 
  


Reply



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
mkdir Huamin Linux - Software 6 05-04-2012 04:42 AM
[SOLVED] mkdir: cannot creat directory. How to enable mkdir for user in usb dir? Foxbat1155 Linux - Newbie 13 02-16-2012 11:20 AM
[SOLVED] mkdir shamjs Programming 3 12-07-2011 12:15 AM
mkdir -p ? shanenin Linux - Software 4 10-19-2011 11:41 AM
how to give options like '-v' for mkdir using system call mkdir() ? nehapawar Linux - Newbie 2 02-05-2010 02:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:39 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
Open Source Consulting | Domain Registration