Linux cat command parameters

Time:2021-12-29

Usage: cat [- abeensttuv] [– help] [– version] filename
Description: connect the file string and transfer it to the basic output (screen or add > filename to another file)
Parameters:
-N or — number numbers the number of rows of all outputs starting from 1
-B or — number nonblank is similar to – N, except that blank lines are not numbered
-S or — squeeze blank when you encounter a blank line with more than two consecutive lines, replace it with a blank line of one line
-V or — show nonprinting
example:
Cat – n textfile1 > textfile2 add the line number to the file content of textfile1 and enter it into the file textfile2
Cat – B textfile1 textfile2 > > textfile3 add line numbers (blank lines are not added) to the file contents of textfile1 and textfile2, and then attach the contents to textfile3.
example:
Add the line number to the file content of textfile1 and enter it into the file textfile2
cat -n textfile1 > textfile2
Add line numbers to the file contents of textfile1 and textfile2 (blank lines are not added) and then attach the contents to textfile3.
cat -b textfile1 textfile2 >> textfile3
cat /dev/null > /etc/test. Txt this is empty / etc / test Txt file content
Cat can also be used to make image files. For example, to create an image file of a floppy disk, put the floppy disk in place and type it
cat /dev/fd0 > OUTFILE
On the contrary, if you want to write the image file to a floppy disk, please type
cat IMG_FILE > /dev/fd0
Note:
1. Outfile refers to the output image file name.
2. IMG_ File refers to image file.
3. If the device is written back from the image file, the capacity of the device should be equal to that of the.
4. It is usually used to make boot disk.

Recommended Today

Hive Foundation

1、 Hive basic concepts Hive is a data warehouse tool based on Hadoop. It can map structured data files into a table and provide SQL like query functions. The essence is:Convert HQL into MapReduce program flow chart Architecture Principle Architecture diagram User interface (client):cli (hive shell), jdbc/odbc (Java access hive), webui (browser access hive) Metadata: […]