Detailed explanation of head commands in CentOS

Source: Internet
Author: User

Head

Name: head-output the first part of files upper part of the input document

Syntax: head [option] file

Function Description: head and tail are very straightforward. They are used to display a certain number of text blocks at the beginning and end, and head is used to display the beginning and end of the file to the standard output, tail is used to view the end of the document.

Parameters:

-N-lines: specifies the number of lines displayed.

-V-verbose output displays the file name

-C-bytes: display by the specified number of bytes

-Q quiet: Hiding file names

Instance:

1) display the first four lines of the file

[Root @ bogon ~] # Head-n 4 test. log

123

234

345

456


2) Output content except the last three lines

[Root @ bogon ~] # Head-n-3 test. log

123

8

9

10

10 is excluded. You need to check the first few rows, then add a number or-4 to the end of-n. If it is excluded, it is-n (minus sign)-4, and the last four rows are excluded.


------------------------------ Subsequent self-Summary -------------------

I think this head function is still very simple, and I have not found any complicated usage changes on the network. Paste it if someone else has it.


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.