View file contents under Linux cat,more,less

Source: Internet
Author: User

1. View frequently used commands for file contents
Cat: The file content is displayed by the first line TAC: Starts from the last line. Contrary to cat nl: File contents and Line numbers output more: One page, one page shows less: similar to more, the ability to page ahead head: Take the head a few lines tail: Take the tail a few lines od: Read the contents of the file in binary mode
2. Cat commands
View Cat's Count cat--h
$ cat-- Husage:cat [OPTION] [FILE] ...  Concatenate FILE (s), or standard input, to standard output. -A,--show-all equivalent To-vet and-vet equivalent-B,--number-nonblank number nonblank ou Tput lines output line number, only for non-blank lines-e equivalent to-ve and             -ve equivalent-E,--show-ends display $ at end of all line file shows $-N,--number                           Number all output lines-s,--squeeze-blank never more than one single blank line Merge multiple blank lines, output only one line-t equivalent to-vt-t,--show-tabs display TAB CH Aracters as ^i TAB is displayed as ^i-v,--show-nonprinting use ^ and m-notation, except for LFD and T AB shows some characters that can't be seen 
$ cat 1hello   Worldhello   Linux
View line 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$
-a The end of the parameter ends with $, and TAB is displayed in ^i. ^m represents the Enter key under Windiows.
Cat is a full display file when the file is larger. Too late to look over the screen. It is recommended to use more or less to view files.
3. More Commands
More pages can be viewed.

$ more filename
Frequently used commands: Spaces space: PAGE DOWN enter: Scroll down one line/string: query string down: F: Show current line number Q: Exit B: Page back. Only works in a file. No effect on the pipe.
4. Less command
Less is also a page-by-page view, and the more different is the ability to page up
$ less filename
Frequently used commands: spaces space: down one page enter: down one line [PageDown]: down page: [PageUp]: Page Up/string: Query down?

String: Query up N: Repeat the previous query/or? N: Reverse forward a query/or?

Q: Exit
Less is similar to the number of the man command because the man command calls less to display the description document.


Address: http://blog.csdn.net/yonggang7/article/details/37341951




View file contents under Linux cat,more,less

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.