|
Use cat command is to link a file or standard input and print.
This command is used to display the contents of a file or several files connected display, or read from standard input and display, it is often used in conjunction with the redirection symbol.
Linux, view the file contents in many ways:
vi filename # View edit mode, you can modify
cat filename # show all file contents
more filename # page display file contents
tail filename # see only the tail, you can also specify the number of rows
head filename # see only the head, you can also specify the number of rows
sed '1, $' p # filename can specify the starting and ending lines of
cat main functions:
1. The first displays the entire file: cat filename
2. Create a file from the keyboard: cat> filename can only create a new file, you can not edit existing files.
3. several files into one file: cat file1 file2> file
Format:
cat [options] [file] ...
Command parameters:
-A, --show-All equivalent to -vET
-b, --number-nonblank number nonempty output lines
-e equivalent to -vE
-E, --show-Ends display $ at end of each line
-n, --number all line number output by 1 the number of rows to start all output numbers
-s, --squeeze-blank blank row over two consecutive lines, one line will be replaced by a blank line
-t and -vT equivalent
-T, --show-Tabs the tab character is displayed as ^ I
-u (ignored)
-v, --show-nonprinting use ^ and M- references, in addition to outside LFD and TAB |
|
|
|