What is the difference between cat, more, and less in Linux?

Source: Internet
Author: User
What is the difference between cat, more, and less commands in Linux? the cat command function is used to display the content of the entire file. it is used independently without paging. Therefore, it is often used together with the more command, the cat command also combines several files into one file. More command function: to make the screen display full page temporarily...
What is the difference between cat, more, and less commands in Linux? the cat command function is used to display the content of the entire file. it is used independently without paging. Therefore, it is often used together with the more command, the cat command also combines several files into one file. More Command: pause the screen when the page is full. press space to continue displaying the next screen or press the Q key to stop the screen. Less command: the usage of the less command is similar to that of the more command. It can also be used to browse files on more than one page. The difference is that the less command can not only display the file down by pressing the space key, but also use the up or down key to scroll the file. To end browsing, press the Q key at the less command prompt. In fact, besides the cat command, www.2cto.com has the function of merging files. the other functions are similar, but they are different in browsing habits and display methods. Name: less permission: Usage of all users: less [Option] filename description: less is very similar to more and can be used to browse the content of a text file, the difference is that less allows users to scroll back to browse the parts that have already been viewed. at the same time, because less does not read the entire file at the beginning, when a large file is opened, it is faster than the general document editor (such as vi. Name: more permission: Usage of all users: more [-dlfpcsu] [-num] [+/pattern] [+ linenum] [fileNames ..] note: Similar to cat, but it will be displayed on one page for users to read on one page, and the most basic command is to display on the next page by pressing the space key, press the B key to display the back page and search for strings (similar to vi). in the instruction file in use, Press h. Parameter:-num indicates the number of rows displayed at a time.-d indicates the user. [Press space to continue, 'Q' to quit.] is displayed at the bottom of the screen. if you Press the wrong key, [Press 'H' for instructions.] is displayed. instead of 'beeps '-l cancels the function that will be paused when a special character ^ L (paper feed character)-f calculates the number of rows with the actual number of rows, rather than the number of rows after the automatic line feed (some rows with too long words will be extended to two or more rows)-p does not show each page in the form of scrolling, instead, the screen is cleared first and then the content www.2cto.com-c is similar to-p. The difference is that the content is displayed first and then the other old data-s is cleared when there are more than two consecutive blank lines, replace it with a blank row-u does not display quotation marks (depending on the terminal specified by the environment variable TERM) +/search for this string (pattern) before each file is displayed ), then, it starts to display + num from Nth The um row starts to display the file whose content is to be displayed in fileNames. the following example shows how many files are displayed: more-s testfile displays the file content in testfile page by page, if there are two or more blank rows in a row, a blank row is displayed. More + 20 testfile: the content of the file testfile is displayed from row 20th. Baidu Space from Qingqing

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.