- Creating new directories
mkdir <path>
: Creates a new directory on the specified file path if such a path exists.mkdir -p <path>
: Creates intermediate directories necessary for creating the desired directory. Discovered while setting Go Workspace and Namespace.
Usage
$ mkdir $HOME/foo/bar # foo does not exist
mkdir: foo: No such file or directory
$ mkdir -p $HOME/foo/bar # both foo and bar directories are created
Usecase: Can create temporary directories
-
Removing Directories
a. Deleting empty directories - 'rmdir path/to/target/directory'
b. Deleting any directory along with the files inside it - 'rm -r path/to/taget/directory