Linux Command explanation-cat command, linux Command explanation cat
The cat command is used to connect to a file or input and print a standard file. Today we will introduce the cat command in Linux.
For more information about Linux commands, see the quick query manual for Linux commands.
The cat command in Linux is usually used to display the file content. It can also be used to connect several files for display, or read and display the content from the standard input. It is often used in combination with the redirection symbol.
I. Syntax format of Linux cat commands
cat [OPTION]... [FILE]..
Parameter description:
-A, -- show-all is equivalent to-vET-B, -- number-nonblank is equivalent to-vE-e, -- show-ends: $-n is displayed at the end of each line. -- number indicates the number of all rows output, starting from 1 to-s, -- squeeze-blank has more than two rows of blank rows, which is equivalent to-t, -- show-tabs: the hop character is displayed as ^ I-u (ignored)-v, -- show-nonprinting uses ^ and M-reference, except for LFD and TAB.
Ii. Linux cat command instance
1) display file content
#cat file1This is a test file.Welcome to linuxdaxue.com!This is cat command test.
2) Add the file1 content to the row number and input it to file2.
#cat -n file1 > file2[root@/root/linuxdaxue.com/testDir]#cat file2 1 This is a test file. 2 Welcome to linuxdaxue.com! 3 This is cat command test.
3) Clear file2 content
#cat /dev/null > file2#cat file2#
4) Linux tac command
Tac is cat, in turn, which is opposite to cat, used to output files from the back to the front.
The following are the differences between the two commands:
[root@/root/linuxdaxue.com/testDir]#cat file1This is a test file.Welcome to linuxdaxue.com!This is cat command test.[root@/root/linuxdaxue.com/testDir]#tac file1This is cat command test.Welcome to linuxdaxue.com!This is a test file.
Now, we will introduce the content of the Linux cat command here. For more information about Linux commands, see the quick query manual for Linux commands.
- Copyright:This site's original article, published three months ago by the Linux University (Linuxdaxue.com), contains 1015 words.
- Reprinted Please note:Linux Command explanation-cat command | Linux University