Linux File Management head

Source: Internet
Author: User

Head display Text Header command English intent
    • Head
Command format
    • head [参数]... [文件]..
Command function
    • Head is as simple as its name, which is used to display the first number of chunks of text, and the head is used to show the beginning of the file to the standard output, while tail is looking at the end of the file.
Common parameters
    • -qHide file names

      -vShow file name

      -c<字节>Number of bytes displayed

      -n<行数>Number of rows displayed

Common Example Example 1

Display specified first few lines

Example 2

Displays the first n bytes of a file

[[email protected] test]# head -c 20 log2014.log2014-012014-022014[[email protected] test]#
Example 3

The contents of the file except the last N bytes

[[email protected] test]# head -c -32 log2014.log2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-112014-12[[email protected] test]#
Example 4

Output file except the last n rows of the entire content

[[email protected] test]# head -n -6 log2014.log2014-012014-022014-032014-042014-052014-062014-07[[email protected] test]#

Linux File Management head

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.