Directory processing command
1. mkdir to create a directory
mkdir /path/name
-p 创建目录,若无父目录,则创建p(parent)
1.1. mkdir -p
Format :mkdir -p /path1/name1
The figure found only one file in the tmp directory, no test files, then therefore mkdir /tmp/test/demo
command error, because there is no test files, and even less to create a new file in the file does not exist, then select a command mkdir -p /tmp/test/demo
found created.
※ These are the "-p" benefits:You can create a directory under the premise that no parent directory, and also create the parent directory。
1.2. Mkdir to create multiple directories
Format : mkdir /path1/name1 /path2/name2
The figure was found in the test tmp directory is only a demo directory, after the command mkdir /tmp/test/demo /tmp/test/demo2
refers to theCreate two directories simultaneously under test, Respectively demo1, demo2.
2. pwd shows the current path to the specified directory and cd
Format : pwd
Format : cd /path1
As shown above, letWith the cd command to move to a directory, then use the pwd command displays the current absolute path, and cd ..
is moving to the parent directory, the original is in the demo, the directory after the execution Back to the test; and cd .
is back the current directory, not change。
3. rmdir to delete empty directories
Format :rmdir /path1/name1
As shown above, rmdir only removes empty directories, because the directory test under tmp, there are demo, demo1, demo2 (three empty directory) under test directory, and then delete empty directories demo can be achieved.