In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article is about what linux commands for viewing files have. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Linux to view the file command: 1, "cat", from the first line to display the contents of the file; 2, "tac", from the last line to show; 3, "nl"; 4, "more", a page of the display of file contents; 5, "less"; 6, "head", only look at the first few lines; 7, "tail", only look at the tail a few lines.
The commands for linux to view the contents of log files are
Cat displays the contents of the file from the first line
Tac shows from the last line, you can see that tac is written backwards for cat.
When nl is displayed, output the line number by the way!
More displays the contents of the file page by page
Less is similar to more, but even better than more, it can turn the page forward!
Head only looks at the first few lines
Tail only looks at a few lines of tail.
You can use man [commands] to view the documentation for each command, such as man cp.
Cat
Command function:
Display the contents of the file from the first line
Command syntax:
Cat [- AbEnTv] displays the entire file at once. $cat filename2. Create a file from the keyboard. $cat > filename can only create new files, not edit existing files. 3. Merge several files into one file: the $cat file1 file2 > file option and the parameter option parameter-An is equivalent to the integration option of-vET, which lists some special characters instead of white space;-b lists line numbers and displays line numbers only for non-blank lines, blank lines are not marked with line numbers! -E displays the ending line break byte $;-n prints the line number, along with a blank line, unlike the option of-b;-T displays the [tab] button as ^ I;-v lists some invisible special characters
Check the contents of the / etc/issue file:
Cat filename # displays the entire file at once. Cat > filename # creates a file from the keyboard. # you can only create new files, not edit existing files. Cat file1 file2 > file # merge several files into one file tac
Command function:
Tac is the opposite of the cat command, and the contents of the file are displayed from the last line. You can see that tac is written backwards for cat!
Command syntax:
Tac [options]
Example
[root@www ~] # tac / etc/issueKernel\ r on an\ mCentOS release 6.4 (Final) nl
Command function:
Displays the line number; the nl command reads the file parameter (standard input by default), calculates the line number in the input, and writes the calculated line number to standard output. In the output, the nl command calculates the left line based on the flag you specify on the command line. The input text must be written on the logical page. Each logical page has a header, body, and footer section (there can be an empty section). Unless you use the-p option, the nl command resets the line number at the beginning of each logical page. Line calculation flags can be set separately for headers, bodies, and footer sections (for example, header and footer rows can be calculated but text lines cannot). The default result is a little different from cat-n. Nl can do more display designs for line numbers, including the number of digits and whether or not to automatically complete 0, and so on.
Command syntax:
Nl [- bnw] file
Options and parameters:
-b: there are two main ways to specify a line number:
-b a: indicates that the line number is also listed regardless of whether it is blank or not (similar to cat-n)
-b t: if there is a blank line, do not list the line number on the blank line (default)
-n: there are three main ways to list the line number representation:
-n ln: the line number is displayed on the far left side of the screen
-n rn: the line number is displayed on the rightmost side of your field without adding 0
-n rz: the line number is displayed on the rightmost side of your field, plus 0
-w: the number of digits occupied by the line number field.
Example: list the contents of / etc/issue with nl
[root@www ~] # nl / etc/issue 1 CentOS release 6.4 (Final) 2 Kernel\ r on an\ mmore
Command function:
Page by page, the more command is a text filter based on the vi editor, which displays the contents of the text file by page in a full-screen manner and supports keyword positioning in vi. There are several keyboard shortcuts built into the more list, such as H (get help information), Enter (scroll down one line), space (scroll down one screen), and Q (exit command).
Command syntax:
More (syntax) (parameter) option description-specifies the number of rows displayed per screen;-d displays "[press space to continue,'q' to quit.]" And "[Press 'h' for instructions]";-c does not scroll. Each time the screen is refreshed;-s compresses multiple blank lines into one line for display;-u forbids underlining; + starts with the line of the specified number.
Example
[root@www ~] # more / etc/man.config## Generated automatically from man.conf.in by the# configure script.## man.conf from man-1.6d.... (omitted in the middle)....-More-- (28%)
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.