A, mkdir (create directory)
mkdir, the command creates the specified directory name, requires the user to create a directory with write permission in the current directory, and specify the directory name can not be the current directory has a directory.
Enter mkdir --help on the command line to view the help information.
[test@VM_0_15_centos ~]$ mkdir --help Usage: mkdir [OPTION]... DIRECTORY... Create the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each created directory -Z set SELinux security context of each created directory to the default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit --version output version information and exit GNU coreutils online help: <http://www.gnu.org/software/coreutils/> For complete documentation, run: info coreutils 'mkdir invocation'
Options introduction:
-m: to create a new directory to set access rights can also be set with the chmod command;
-p: can be a path name. At this point, if some of the directory path does not yet exist, after adding this option, the system will automatically build a good directory that does not yet exist, that one can create multiple directories;
-v: print information represents each directory created.
-z: From a semantic point of view, it is to set the level SELinux security context when creating a directory for each ctx.
-help, -version is a display help information, a version number is displayed
[test@VM_0_15_centos ~]$ mkdir mysql [test@VM_0_15_centos ~]$ ls chmod help hosts linux maillog mysql passwd python
-p parameters, you can create multi-level directory
[test@VM_0_15_centos ~]$ mkdir qq/ww/ee/ss mkdir: cannot create directory ‘qq/ww/ee/ss’: No such file or directory [test@VM_0_15_centos ~]$ mkdir -p qq/ww/ee/ss [test@VM_0_15_centos ~]$ ll -d qq/ww/ee/ss/ drwxrwxr-x 2 test test 4096 Aug 18 21:50 qq/ww/ee/ss/
-m is administrative privileges, -v is created to display the information.
[test@VM_0_15_centos ~]$ mkdir -v dir mkdir: created directory ‘dir’ [test@VM_0_15_centos ~]$ rm -fr dir/ [test@VM_0_15_centos ~]$ mkdir -m 700 dir [test@VM_0_15_centos ~]$ ll dir/ total 0 [test@VM_0_15_centos ~]$ ll total 100 -rwxr-xr-x 1 test test 58544 Aug 18 18:40 chmod drwx------ 2 test test 4096 Aug 18 21:54 dir
Two, touch (create a directory)
touch command is mainly used to modify the file timestamp, or create a file does not exist
[test@VM_0_15_centos ~]$ touch --help Usage: touch [OPTION]... FILE... Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created empty, unless -c or -h is supplied. A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output. Mandatory arguments to long options are mandatory for short options too. -a change only the access time -c, --no-create do not create any files -d, --date=STRING parse STRING and use it instead of current time -f (ignored) -h, --no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can change the timestamps of a symlink) -m change only the modification time -r, --reference=FILE use this file's times instead of current time -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time --time=WORD change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m --help display this help and exit --version output version information and exit Note that the -d and -t options accept different time-date formats.
-A change in the reading file time records. -M change to modify file time records. -C If the purpose of the file does not exist, does not create a new file. And --no- the same effect create a. - H, does not interfere with references to the impact of each symbolic link, rather than all reference files (only applicable to systems change a sign, time stamp) -f does not perform the actual operation, for compatibility with other unix system reserved . -R recording reference time profile, and - File effect the same. -D set the time and date, you can use a variety of different formats. -T set time record file format as the date the same instruction. [[CC] YY] MMDDhhmm [ .SS], CC is the number of years in the first two, namely "centuries"; YY is the last two digits of the year, namely a number of years, if not centuries value of CC is given. the linux in touch command parameters will limit the number of years CCYY in 1969--2068 of .MM is the number of the month, DD for the day will be limited to the number of years CCYY the number of days in the 1969--2068 of .MM to several months, DD, hh number (several) hours, mm the number of minutes, SS is seconds. here the second setting range is 0-- 61 is so leap seconds can be processed. time these numbers are specified by the environment variable time zone TZ of a time. due to system constraints, earlier than the time January 1, 1970 is wrong. --no- the Create will not create a new file. - Help list Help --version Display version information
Create a file
[test@VM_0_15_centos ~]$ touch test.txt [test@VM_0_15_centos ~]$ ll test.txt -rw-rw-r-- 1 test test 0 Aug 18 22:02 test.txt
-m parameter change file time
[test@VM_0_15_centos ~]$ touch -m test.txt [test@VM_0_15_centos ~]$ ll test.txt -rw-rw-r-- 1 test test 0 Aug 18 22:04 test.txt
-t parameter specifies the time to create the file
[test@VM_0_15_centos ~]$ touch -t 201907102312.33 test.txt [test@VM_0_15_centos ~]$ ll test.txt -rw-rw-r-- 1 test test 0 Jul 10 23:12 test.txt
-r parameter
# The file recording time is changed to the referencefile same. touch -r referencefile file
[test@VM_0_15_centos ~]$ touch -r b.txt test.txt [test@VM_0_15_centos ~]$ ll b.txt test.txt -rw-rw-r-- 1 test test 0 Aug 18 22:12 b.txt -rw-rw-r-- 1 test test 0 Aug 18 22:12 test.txt