Learn a Linux command every day--cat[for connecting files and printing to standard output devices]

Source: Internet
Author: User

Syntax format:cat [-abeensttuv] [--help] [--version] FileName

parameter description:
-N or--number: Numbers the number of rows for all outputs starting from 1.
-B or--number-nonblank: Similar to-n, except that blank lines are not numbered.
- s or--squeeze-blank: a blank line that is substituted for a row when it encounters a blank line that has more than two consecutive lines.
-V or--show-nonprinting: Use the ^ and m symbols, except for LFD and TAB.
-E or--show-ends: Displays $ at the end of each line.
-T or--show-tabs: Displays the TAB character as ^i.
-E: equivalent to-ve.
-A,--show-all: equivalent to-vet.
-T: equivalent to the "-vt" option.

set file1 and File2 are the two files in the current directory:
case1:cat file1 ———— Display the contents of the file file1 on the screen;
case2:cat file1 file2 —————— Display the contents of the file File1 and file2 simultaneously on the screen;
case3:cat >file3 ———————— Create a file file3[can only create new files, cannot edit existing files];
Case4 cat file1 file2 >file4 —————— Merge the contents of the file File1 and file2 into the file file4, before the file4 content is overwritten;
Case5:cat-n file1 > File5 —————— The document content of the File1 is written to the file File5, and the content before file5 is overwritten;
Case6:cat-b
file1 —————— Add a line number to the contents of the File1 file (blank line) and display on the screen;
Cae7:cat/dev/null >file1 —————— Empty the contents of the file file1 [/dev/null : Represents the empty device file];
Case8:
cat/dev/fd0 > OUTFILE —————————— Making the image file of the floppy disk;
case9:cat img_file >/dev/fd0 ———————— to write the image FILE to a floppy disk;
Case10:cat-b file1 file2 >> file3 ———— Add the contents of File1 and File2 to the end of File3 after adding the line number (blank line), and the contents of the file File3 will not be overwritten.
case11:cat file1 |grep ' xxx ' ———— find xxxx in file file1;
Case12:tac file1 —————— and Cat instead, the contents of the file1 are displayed in reverse on the screen from the last line to the first line;

Note:
1. OUTFILE refers to the image file name of the output.
2. Img_file refers to image FILE.
3. If the device is written back from image file, the device capacity needs to be equivalent.
4. Usually used in the production of the boot magnetic chip.

Learn a Linux command every day--cat[for connecting files and printing to standard output devices]

Related Article

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.