Basic Linux usage-display file content-general Linux technology-Linux technology and application information. For more information, see the following. 1. cat
Is to directly display the content of the file to the screen, the following operations:
The preceding content is relatively large. "omitted. We only see the part after this file. It can be seen that this command is suitable for displaying less content than the maximum number of lines displayed on the screen.
This command also has the opposite method of tac. What do you want to display?
2. more
The cat command can only view part of the file or only a small file. To solve this problem more, perform the following operations:
Note that a prompt is displayed at the bottom, indicating that only 2% of the file is displayed. Press the Space key to go over the next page. When the content is displayed, the system automatically exits, you can also press the "Q" key to exit.
3. less
More can display relatively large files, but it also has a disadvantage that it cannot flip pages up. To view the content again, you must re-run the command. Less solves the problem of the more command. Follow these steps:
The name of this file is shown at the bottom. We can use "PageUp" and "PageDown" to flip the previous and next pages. If you want to know the specific control key, you can press the "H" key to display all the control keys of the less command. If you want to end the operation, press the "Q" key.
4. head and tail
The above are the most commonly used commands for displaying file content. Here we also introduce two commands for displaying file content: head and tail, and head is the first few lines of the file, tail is the last few lines of the file. By default, it is 10 lines. Follow these steps:
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.