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

How to use the Linux head command

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to use the Linux head command". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use the Linux head command.

Head displays the beginning of the file.

Summary head [OPTION]... [FILE]... The first 10 lines are displayed by default when the number of rows is not specified.

When working with multiple files, lines with file names are appended to each file.

Read standard input when there is no file or when the file is -.

The option-c,-- bytes= [-] NUM displays the first NUM bytes; if there is a "-" before the NUM, something other than the NUM byte at the end of the file is printed. -n,-- lines= [-] NUM displays the first NUM line instead of the default 10 lines; if there is a "-" before NUM, lines other than the NUM line at the end of the file are printed. -Q,-- quiet,-- silent does not print file name lines. -v,-- verbose always prints the file name line. -z,-- zero-terminated line Terminator is NUL instead of a newline character. -- help displays help information and exits. -- version displays version information and exits. NUM can have a multiplier suffix: b512 kB 1000 k 1024 MB 1000 "1000 M 1024" 1024 GB 1000 "1000 G 1024" 1024 "1024 T, P, E, Z, Y, and so on. You can also use the binary prefix: KiB=K MiB=M, and so on. Parameter FILE (optional): the file to be processed can be one or more.

A return value of 0 indicates success, while a non-zero value indicates failure.

Example # View the first six lines of the history file: [user2@pc ~] $head-n 6 ~ / .bash_history # 1575425555 cd ~ # 1575425558 ls-lh # 1575425562 vi ~ / Desktop/ZhuangZhu-74.txt # View multiple files: [user2@pc ~] $head-n ~ / .bash_history ~ / .bashrc = > / allhome/user2/.bash_history / allhome/user2/.bashrc Thank you for reading, this is the content of "how to use the Linux head command" After the study of this article, I believe you have a deeper understanding of how to use the Linux head command, 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.

Share To

Development

Wechat

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

12
Report