Latest web development tutorials

Linux cat Command

Linux command Daquan Linux command Daquan

Command: cat

The cat command after the file reached the basic connection string output (screen or add> fileName to another file)

Permissions

All users

Syntax

cat [-AbeEnstTuv] [--help] [--version] fileName

Parameter Description:

-n or --number starting from 1 to all outputs the line number

-b and -n --number-nonblank or similar, except for the blank line is not numbered

-s or --squeeze-blank when faced with two blank lines or more consecutive lines, with a blank line on the substitution line

-v or --show-nonprinting

Example:

The contents of the file textfile1 with a line number in this file after entering textfile2

cat -n textfile1 > textfile2

The contents of the file textfile1 and textfile2 with a line number (without blank lines) after the content is appended to textfile3 years.

cat -b textfile1 textfile2 >> textfile3

Empty the contents of the file /etc/test.txt

cat /dev/null > /etc/test.txt

cat can also be used to create an image file. For example, to make the floppy disk image files, floppy put away after play

cat /dev/fd0 > OUTFILE

Conversely, if you want to write the floppy disk image file, please call

cat IMG_FILE > /dev/fd0

NOTE:

  • 1. OUTFILE refers to the image output file name.
  • 2. IMG_FILE refers to the image file.
  • 3. If the write-back from the image file when the device, device capacity and need considerable.
  • 4. typically used in the production boot disk.

Linux command Daquan Linux command Daquan