Linux: view the file contents

The file contents

cat view the file content
of the command is used to print out the contents of a file or the display terminal window.
Format:
CAT [options] filename
-n are numbered starting with 1 for the number of lines all output
-b non-numbered rows of blank lines all the output from the beginning 1
-s when faced with more than two consecutive blank lines line, with a blank line instead of

Page display file contents

Fullscreen way paging file contents, when the contents of pauses full screen, press the spacebar
to display the next screen, or press q jump off, suitable for reading long documents.

Part of view the beginning or end of the file

By default,
the front rows 10 display the content head
10 row display contents tail

File Content Statistics

Role: statistics for the number of lines in the specified file, word count, number of bytes.
Syntax: wc (Option) (parameters)
common options:
the -l statistics lines
-w count the number of words
-c count the number of bytes

Browse the entire contents of the file

more / less
when the contents of the file is too large, you can use more or less commands to view.
Format:
More file name
less filename

Displays the file header / trailer information

head / tail
head front command to view the file in rows, a plurality of lines after the tail command to view the file, the default view line 10.
Format:
head [options] filename
tail [options] filename

Query String

grep query string
grep command to match the string in the specified text file, the output string matching the entire contents of the row.
Format:
grep keyword Look

Guess you like

Origin www.cnblogs.com/yanlzy/p/11870564.html