What command will create a new subdirectory? For example I would like to create a new subdirectory called TEMP of a parent directory /tmp/.
Creating directories on a linux system is done by use of mkdir command. Please note that Linux shell is case sensitive, therefore, temp and TEMP are two distinct directories. Below you can find a basic usage of the mkdir command. Visit the following link for more advanced mkdir command usage. Let's start be creating a single directory within a current working directory:
$ mkdir TEMP
The command above will create a directory called TEMP within your current working directory. The following linux command will create test directory inside /tmp/. Here the command assumes that /tmp/ directory already exists:
$ mkdir /tmp/TEMP
The last command example will create a new TEMPdirectory as a subdirectory of /tmp/test even if test does not exists.
$ mkdir -p /tmp/test/TEMP
The above -p will instruct mkdir directory to create any parent directory if it does not exist. Executing mkdir command without -p option will result in error message:
$ mkdir: cannot create directory ‘/tmp/test/TEMP’: No such file or directory