Linux one command per day: Cat

Source: Internet
Author: User

Linux Cat Command command: Cat

The cat command is used to connect files and print to standard output devices.

Use permissions

All Users

Syntax format
Cat[-ABEENSTTUV] [--help] [--Version] Filename[[email protected]]#Cat--Helpusage:Cat[OPTION] ... [FILE] ... Concatenate FILE (s), or standard input, to standard output.-A,--show-all equivalent to-VET-B,--number-nonblank number nonempty output lines, overrides-N-e equivalent to-VE-E,--show-ends display $ at end of each line-N,--Number number all output lines-S,--squeeze-blank suppress repeated empty output lines-T equivalent to-VT-T,--show-tabs display TAB characters as ^I-u (ignored)-V,--show-nonprinting use ^ and m-notation, except forLFD and TAB--Help display this help and exit--version output version information and Exitwith no file, or when file is-, read standard input. Examples:CatF-g Output F's contents, then standard input, then G's contents.CatCopy standard input to standard output.
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.

- E: equivalent to "-ve" option;

- T: equivalent to the "-vt" option;

Instance

Add the Textfile1 document content to the line number and enter Testfile2 in this document:

cat testfile1 > Testfile2

Append the contents of the Testfile1 and testfile2 documents to the TESTFILE3 document after adding line numbers (blank lines):

Cat -B testfile1 testfile2 >> testfile3

Empty the contents of the/etc/test document:

cat /dev/null > Testfile

Cat can also be used to make image files. For example, to make a floppy disk image file, put the floppy disk and enter:

cat /dev/fd0 > OUTFILE

Conversely, if you want to write the image file to a floppy disk, enter:

Cat Img_file >/dev/fd0

Note :

    • 1. OUTFILE refers to the image file name of the output.

    • 2. Img_file refers to the image file.

    • 3. If you write back to device from the image file, the device capacity needs to be equivalent.

    • 4. Usually make the boot magnetic chip.

    • 5. Usually/dev/null as a "black hole". It is very equivalent to a write-only file. All content written to it will be lost forever. While trying to read from it, nothing can be read. However,/dev/null is very useful for command lines and scripts.

***********************************************************

It is never too late to learn. --high-base

***********************************************************

Linux one command per day: Cat

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.