View file contents under linux cat,more,less

  
        

1. View the commonly used commands for file contents
cat : Display the contents of the file from the first line tac: Display from the last line, opposite to cat nl : File content and line number output more: One page display Less: Similar to more, you can turn the page forward head: Take a few lines of the head tail: Take a few lines at the end od: Read the contents of the file in binary

2. cat command
View the cat parameter cat -- h

$ cat --hUsage: cat [OPTION] [FILE]...Concatenate FILE(s), or standard input, to standard output. -A, --show-all equivalent to -vET and -vET etc. Price-b, --number-nonblank number nonblank output lines output line number, only for non-blank lines -e equivalent to -vE and -vE equivalent -E, --show-ends display $ at end of each line Show $ -n, --number number all output lines Travel number -s, --squeeze-blank never more than one single blank line Combine multiple blank lines, output only one line -t equivalent to -vT -T, --show-tabs display TAB characters as ^I Show TAB as ^I -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB Show some invisible characters 
$ cat 1hello worldhello linux view line number and special symbol 
$ cat -n 1 1 hello world 2 3 4 hello linux 5$ cat -A 1 hello^Iworld^M$^M$^M$hello^Ilinux^M$^M$-A The end of the parameter ends with $, TAB is displayed with ^I, ^M indicates the Enter key under windiows. Cat shows the file all at once, when the file is relatively large, it is too late to see the screen. It is recommended to use more or less to view the file. 

3. more command
more can be turned over.

$ more filename Common command: space space: page down Enter: scroll down one line/string: query string down: f: display current line number q: exit b: page backwards, only in The file has a role and has no effect on the pipeline. 

4. less command
less is also a page-by-page view. Unlike more, you can page up

$ less filename commonly used commands: space space: down one page Enter: next line [PageDown] : Next page: [PageUp] : Up page/string: Query down? String: Query up n: Repeat previous query /or ? N : Reverse forward query /or ? q : The argument to exit less is similar to the argument of the man command, because the man command is to call the less display documentation. Address: http://blog.csdn.net/yonggang7/article/details/37341951
Copyright © Windows knowledge All Rights Reserved