Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux basic command-head

Shulou Source: shulou.com Published: 2022-06-02 05:54:13 09月10日 Update

Head

Displays the first few lines of the file, with 10 lines by default. You can use the option-n to specify the number of lines. The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Head [options] files

2. List of options

Option

Description

-- version

Display command version information

-- help

Show help documentation

-c |-- bytes= [-] K

Displays the first n bytes of the file;-n displays everything, but does not include the last n bytes

-n |-- lines= [-] K

Displays the first k line;-k shows all lines, but does not include the last k line

-Q |-- quite |-- silent

Do not display file name

-v |-- verbose

Show file name

3. Examples

1) display the first 10 bytes

[root@localhost weijie] # cat 5.c / / View all content

1,2c1,2

< 123 < 23 --- >

12345

> 2334

[root@localhost weijie] # head-c 10 5.c / / display the first 10 bytes

1,2c1,2

Tags: Byte beginning file command content file name information instance document version scope syntax scope help foundation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Shulou Tech Info MySQL Huawei