Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to create this folder: $HOME/a/b/c/d while $HOME/a is not created! Is it possible by one line in Terminal?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can use the command mkdir with -p option to create a folder inside another non-existent folder. Consider an example,

mkdir -p "$HOME/a/b/c/d"

Where the folders a,b,c and d do not exist in home before running the command. After execution of the command all these folders will be created recursively inside one another.

You can see from man mkdir

-p, --parents
          no error if existing, make parent directories as needed
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.