In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "use of head commands in linux", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of head commands in linux" bar!
1. Command format:
Head [parameters]... [file].
2. Command function:
Head is used to display the beginning of an archive to standard output, and the default head command prints the first 10 lines of its corresponding file.
3. Command parameters:
-Q hide file name
-v displays the file name
-c displays the number of bytes
Number of rows displayed by-n
4. Use an example:
Example 1: display the first n lines of the file
Command:
Head-n 5 log2014.log
Output:
The code is as follows:
[root@localhost test] # cat log2014.log
2014-01
2014-02
2014-03
2014-04
2014-05
2014-06
2014-07
2014-08
2014-09
2014-10
2014-11
2014-12
= =
[root@localhost test] # head-n 5 log2014.log
2014-01
2014-02
2014-03
2014-04
2014-05 [root@localhost test] #
Example 2: display the first n bytes of the file
Command:
Head-c 20 log2014.log
Output:
The code is as follows:
[root@localhost test] # head-c 20 log2014.log
2014-01
2014-02
2014
[root@localhost test] #
Example 3: the contents of the file except the last n bytes
Command:
Head-c-32 log2014.log
Output:
The code is as follows:
[root@localhost test] # head-c-32 log2014.log
2014-01
2014-02
2014-03
2014-04
2014-05
2014-06
2014-07
2014-08
2014-09
2014-10
2014-11
2014-12 [root@localhost test] #
Example 4: all the contents of the output file except the last n lines
Command:
Head-n-6 log2014.log
Output:
The code is as follows:
[root@localhost test] # head-n-6 log2014.log
2014-01
2014-02
2014-03
2014-04
2014-05
2014-06
2014-07 [root@localhost test] #
Thank you for your reading, these are the contents of "the use of head commands in linux". After the study of this article, I believe you have a deeper understanding of the use of head commands in linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.