2.6 the text file editing commands
1. The cat command
The cat command to view plain text files (less contents), the format of "cat [option] [file]."
2. more command
more command is used to view the plain text files (more content), the format is "more [options] file."
3. head command
N lines before the head command is used to view the plain text of the document in the format of "head [options] [file]."
4. tail command
tail command for viewing after the N line plain text document or continue to refresh the content in the format of "tail [options] [file]."
5. tr command
tr command is used to replace characters in a text file, the format of "tr [original character] [target character]."
6. wc command
Wc command line number of specified text, words, bytes, the format of "wc [parameter] Text."
wc的参数以及作用
参数 作用
-l 只显示行数
-w 只显示单词数
-c 只显示字节数
7. stat command
stat command is used to store specific information and time to review documents and other information, in the format of "stat file name."
8. cut command
cut command is used to press the "Columns" extract text character in the format of "cut [parameters] text."
If the column Search by not only using the -f parameter to set the number of columns need to see, but also need the -d parameter to set the interval symbol .
9. diff command
diff diff command for a plurality of text files, the format of "diff [parameter] file."
2.7 directory management commands
1. touch command
Time touch command to create a blank file or set of files in the format of "touch [options] [file]."
parameters and their effect touch command
参数 作用
-a 仅修改“读取时间”(atime)
-m 仅修改“修改时间”(mtime)
-d 同时修改atime与mtime
2. mkdir command
mkdir command is used to create a blank directory, in the format "mkdir [options] directory."
3. cp command
cp command to copy a file or directory, in the format "cp [options] source file destination." We file copy operation should no stranger to the Linux system, the copy operation is divided into three specific cases:
If the target file is a directory, it will copy the source files into the directory;
If the target file is an ordinary file, you are asked whether you want to overwrite it;
If the target file does not exist, the normal copy operation is performed.
cp command parameters and their effect
参数 作用
-p 保留原始文件的属性
-d 若对象为“链接文件”,则保留该“链接文件”的属性
-r 递归持续复制(用于目录)
-i 若目标文件存在则询问是否覆盖
-a 相当于-pdr(p、d、r为上述参数)
4. mv command
mv command is used to cut the file or rename the file, the format is "mv [options] source [destination path | destination file name]."
5. rm command
rm command is used to delete a file or directory, in the format "rm [options] files."
2.8 compression and packing search command
1. tar command
tar command is used to package a file compression or decompression, the format of "tar [options] [file]."
-c parameter is used to create a compressed file, -x parameter is used to extract the files, so these two parameters can not be used simultaneously. Secondly, -z parameter specifies the format to use Gzip compress or decompress files, -j to use bzip2 format parameter specifies to compress or decompress files.
2. grep command
grep command is used to perform a search keyword in the text, and display the results match the format of "grep [options] [file]."
-c displays only to find the number of lines
-i ignore case
-n show line number
3. find command
find command to find the conditions for the specified file, the format of "find [Search Path] Looking operating conditions."
-prune ignore a directory