View File Content in linux cat, more, less

Source: Internet
Author: User

View File Content in linux cat, more, less
1. Common commands for viewing File Content
Cat: displays the file content from the first line. tac: displays the content from the last line. The opposite is cat. nl: The file content and line number are output together. more: one page and one page show less: similar to more, you can flip the head forward: Get the first few lines of tail: Get the end of a few lines of od: Read the file content in binary mode
2. cat command
View cat -- h

$ Cat -- hUsage: cat [OPTION] [FILE]... concatenate FILE (s), or standard input, to standard output. -A, -- show-all equivalent to-vET and-vET are equivalent to-B, -- number-nonblank number nonblank output lines output line number, only for non-blank rows-e equivalent to-vE and-vE equivalent-E, -- show-ends display $ at end of each line at the end of the file $-n, -- number all output lines output row number-s, -- squeeze-blank never more than one single blank line Merge multiple blank rows, only output one row-t equivalent to-vT-T, -- show-tabs display TAB characters as ^ I displays the TAB as ^ I-v, -- show-nonprinting use ^ and M-notation, character t for LFD and TAB displays invisible characters
$ cat 1hello   worldhello   linux
View row numbers and special symbols
$ cat -n 1     1  hello   world     2     3     4  hello   linux     5$ cat -A 1 hello^Iworld^M$^M$^M$hello^Ilinux^M$^M$
-The A parameter ends with $, and the TAB displays ^ I. ^ M indicates the return key under windiows.
Cat displays all files at a time. When the files are large, the screen is turned over when it is too late to view them. We recommend that you use more or less to view files.
3. more command
More can be viewed on pages.
$ more filename
Common commands: space: Flip down Enter: Scroll down a line/string: Query down string: f: display current line number q: Exit B: Flip back, only in the file, it does not work on pipelines.
4. less command
Less is also a page-by-page view. Unlike more, you can flip the page up.
$ less filename
Common commands: space: Flip down one page Enter: Next line [PageDown]: To next page: [PageUp]: To Previous Page/string: Query down? String: Query up n: repeat the previous query // or? N: reverse query/or? Q: Exit
The less parameter is similar to the parameter of the man command, because the man command calls the less display instruction document.
Address: http://blog.csdn.net/yonggang7/article/details/37341951




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.