Linux Command explanation-cat command, linux Command explanation cat

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.