In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how Linux looks at the contents of a file. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Cat displays the contents of the file from the first line
Usage:
Cat-An is equivalent to the integration option of-vET, listing some special characters instead of whitespace
Cat-b lists line numbers. Line numbers are displayed only for non-blank lines. Blank lines are not marked with line numbers.
Cat-E displays the ending line break byte $
Cat-n prints the departure number, along with a blank line, which is different from the option of-b
Cat-T displays the [tab] button as ^ I
Cat-v lists some unrecognizable special characters
2. Tac displays the contents of the file from the last line
Usage:
Tac-b adds a separator before the line instead of at the end of the line
Tac-r parses the delimiter as a regular expression
Tac-s uses a specified string instead of a newline as a separator
3. Nl displays the line number
Usage:
Nl-b a lists the line number regardless of whether it is blank or not
Nl-b t blank lines do not list line numbers
The nl-n ln line number is displayed on the leftmost side of the screen
The nl-n rn line number is displayed on the rightmost side of its own field without adding 0
The nl-n rz line number is displayed on the rightmost side of its own field, plus 0
The number of digits occupied by the nl-w line number field
4. More displays the contents of the file page by page
Usage:
While the more program is running, you can press the following keys:
Blank key (space): for turning down one page
Enter: stands for turning down "one line"
/ string: means to search down for the keyword "string" in this display
: F: immediately show the file name and the number of lines currently displayed
Q: the representative immediately leaves the more and no longer displays the contents of the file.
B or [ctrl]-b: means to turn the page back, but this action is only useful for files, not for pipelines.
Less is similar to more, but better than more, it can turn the page forward.
Usage:
The commands that can be entered during less runtime are:
Blank key: turn down one page
[pagedown]: turn a page down
[pageup]: turn a page up
/ string: the function of searching down for "string"
? String: the function of searching up for "string"
N: repeat the previous search (and / or? Related!)
N: reverse repetition of the previous search (and / or? Related!)
Q: leave the less program
6. Head displays the first few lines
Syntax:
Head-n is followed by a number to represent the number of lines displayed
7. Tail displays the next few lines
Usage:
Tail-n is followed by a number to represent the number of lines displayed
Tail-f indicates continuous detection of the following file name, and the tail detection will not end until [ctrl]-c is pressed.
Thank you for reading! This is the end of this article on "how to view the contents of Linux files". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.