Creating Files and Directories

In the previous module we discussed how to move between directories and view their contents, we are now going to discuss how to create files and directories.

Directory creation

To create a directory, type mkdir followed by the name of the directory you want to create.

[user@host ~]$ mkdir a_directory
[user@host ~]$ ls
a_directory  Scratch  shell-training

To create two directories at the same time: just separate the names with a space.

[user@host ~]$ mkdir b_directory c_directory
[user@host ~]$ ls
a_directory  b_directory  c_directory  Scratch  shell-training

If we want to create a directory in a specific location we put the path to an existing directory before your new directory name to create a directory in that location.

[user@host ~]$ mkdir shell-training/a_directory
[user@host ~]$ ls shell-training
a_directory  animals  data  docs  scripts

Next activity: Reading - Wildcards.