Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux basic command-head

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report