Use the head command of linux to display the beginning of the file
Editor to share with you the use of linux's head command to display the beginning of the file, I hope you will learn a lot after reading this article, let's discuss it together!
The head command fetches the contents of the file in behavior units, and prints the first 10 lines by default without parameters.
Syntax format: head [parameters] [file]
Common parameters:
-n is followed by a number, which means how many lines to display-c specifies the number of characters to display high-quality content-v always displays the header information of the file name-Q does not display the header information of the file name
Reference example
Display the contents of the first 3 lines of the file:
[root@linuxcool] # head-n 3 install.logInstalling libgcc-4.4.7-23.el6.x86_64warning: libgcc-4.4.7-23.el6.x86_64: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYInstalling setup-2.8.14-23.el6.noarch
Displays the file name information and the first two lines of the file:
[root@linuxcool] # head-v-n 2 test.txt = = > test.txt