To create a new directory in Linux, you can use the mkdir
command.
mkdir projects
ls
# projects
To create a new directory recursively in linux, add the -p
or --parents
option to the mkdir
command.
mkdir -p projects/web/my-web-app
ls
# projects
ls projects
# web
ls projects/web
# my-web-app
Using this method, you can create a new directory along with all necessary parent directories in a single mkdir
command.
The -p
or --parents
option means that if any of the parent directories do not exist, they will be created automatically without throwing any errors.
Top comments (0)