About linux command to view file

View files in Linux we used cat less more grep
through practice come to view all the file contents
of large files is best to use less can use the arrow keys to select
a small file with cat more less the entire contents can be displayed, but not recommended less small-file viewing, publishing unsightly.

grep used not only in the pipeline
more had to use grep to find matching files in the field, such as columns:

-A 3 # grep "root" / etc / the passwd
# Find comprises "root" of the line, and lists the subsequent rows 3

-n # grep "/ bin / bash" / etc / passwd
# Find a user can log on and displays the line number

Interpretation common parameters
-A figures: qualifying row lists, and list the subsequent row n;
-B figures: List qualifying rows and n lines listed earlier;
-C: Eligible statistical Found the number of strings;
-i: ignore case;
-n: output line number;
-v: reverse lookup;
-color = Auto: a keyword search with color display

Guess you like

Origin blog.csdn.net/tang3827738w/article/details/92185621