Directory management class commands for Linux commands: mkdir, rmdir, tree, DirName, basename
mkdir command: Create a new directory
Syntax: mkdir [OPTION]/path/to/somewhere
Common parameter options:
-P: Create parent Directory
-V: Show creation process
Example:
How to create a directory under/tmp/: X_m, X_n, Y_m, Y_n
# mkdir/tmp/{x_,y_}{m,n}
rmdir command: Delete directory
Syntax: Rmdir/path/to/somewhere
Common parameter options:
-P: Delete along with empty directory on upper level (use cautiously)
Tree command: List contents of a table
Syntax: Tree [OPTION] ... [DIR]
-D: File of only hierarchical directory type;
-L Level: shows only a few levels;
dirname command: Removes the file name (part of the non-directory) from the given file name that contains the absolute path, and then returns the remaining
Path (part of the directory)
Syntax: DirName FILENAME
Example:
# Dirname/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts
basename command: Removes the left part of the directory from a given file name that contains an absolute path, or simultaneously removes a suffix within
(Part of the directory), and then return to the remainder (part of the non-directory)
Syntax: basename FILENAME [SUFFIX]
Example:
#basename/etc/sysconfig/network-scripts/ifcfg-eth0
Ifcfg-eth0
This article is from the "10,000-hour Law" blog, be sure to keep this source http://daisywei.blog.51cto.com/7837970/1687820
Directory management class commands for Linux commands: mkdir, rmdir, tree, DirName, basename