Linux command: cat

cat

1. Role
cat ( "concatenate" abbreviation) for connecting a command and display information and a plurality of specified files, its usage rights for all users.

2. Format

cat [options] 文件1 文件2……

3. [options] The main parameters
-n: starting from the first row number of the number of lines of all outputs.
-B: -n and similar, but not number blank lines.
-S: When faced with more than two successive rows of empty rows on the substitution of one line blank line.

4. Application examples

(1) cat command simplest use is to display the contents of a text file. For example, we want to look at the contents of the README file on the command line, you can use the command:

$ cat README 

(2) may need to be several documents processed into a file, and save the results of such processing into a single output file. cat command accepts one or more files on its input, and prints them to its output as a single file. For example, after the contents of the file README and INSTALL plus line number (without blank lines), the content attached to a new text file in File1:

$ cat README INSTALL File1

(3) cat Another important feature is the numbered lines. This feature is very convenient for the preparation of program documentation, and the preparation of legal and scientific documents, print the line numbers on the left so that a portion of the reference document easier, these programming, science, business reports and even legislation are is very important. /Etc/named.conf file using the cat command numbered rows are numbered function -b (only non-blank lines are numbered) and -n (may be numbered for all rows) two parameters:

$ cat -b /etc/named.conf

 

Guess you like

Origin blog.csdn.net/q1449516487/article/details/93379243