Linux cat command usage Linux Cat command has three main functions: www.2cto.com 1. Linux Cat command displays the entire file at a time. $ Cat filename2.Linux Cat command creates a file from the keyboard. $ Cat> filename (only new files can be created, and existing files cannot be edited) 3. the Linux Cat command combines several files into one file. $ Cat file1 file2> file
Parameter:-n or -- number indicates the number of all output rows starting from 1-B or -- number-nonblank is similar to-n, however, if a blank row is not numbered-s or -- squeeze-blank and there are two or more consecutive blank rows, it is replaced by a blank row-v or -- show-nonprinting example: cat-n textfile1> textfile2 Add the textfile1 file content to the row number and enter textfile2 in the file cat-B textfile1 textfile2> textfile3 Add the textfile1 and textfile2 file content to the row number (no blank lines) add) then, append the content to textfile3.
Example: cat-n textfile1> textfile2 Add the textfile1 file content to the row number and enter textfile2 in the file cat-B textfile1 textfile2> textfile3 Add the textfile1 and textfile2 file content to the row number (no blank lines) add) then, append the content to textfile3. Cat/dev/null>/etc/test.txt this indicates clearing the/etc/test.txt file content. cat can also be used to create an image file. Cat/dev/fd0> OUTFILE: for example, to create an image file for a soft disk, put the soft disk and press cat IMG_FILE>/dev/fd0. If you want to write the image file to the soft disk, press
Note: 1. OUTFILE indicates the output image file name. 2. IMG_FILE refers to image file. 3. If the device is written back from the image file, the device capacity must be equal to that of the device. 4. It is usually used to make boot CIDS.