Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a linux command that I'm overlooking that makes it possible to do something along the lines of: (pseudo)

$ mkdir -R foo/bar/zoo/andsoforth

Or is there no alternative but to make the directories one at a time?

share|improve this question

migrated from serverfault.com Sep 27 '12 at 3:56

This question came from our site for system and network administrators.

linux.die.net/man/1/mkdir – Zoredache Aug 7 '12 at 20:36
funny, I was looking at that page but totally overlooked "parent" because I was thinking of them as children (left to right). – Dr.Dredel Aug 7 '12 at 20:37
Protip: In some shells you can even do mkdir -p foo/{bar,baz}/zoo/andsoforth. Very useful! – Aaron Copley Aug 7 '12 at 20:43
up vote 132 down vote accepted
$ mkdir -p foo/bar/zoo/andsoforth
share|improve this answer
FYI the -p stands for "parents" – delinquentme Apr 22 '15 at 17:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.