Head View the contents of the start of a file
1 , command format
Head [option] ... [File] ...
2 , command functions
show file contents, default display of the first 10 lines of the file, you can use [-n] # | [-#] # represents the number of rows displayed, the option specifies how many rows are displayed , if not " file file " when reading input from standard input
3 , common options
- C # : Displays the bytes of the file ( character ) number
- N # : Shows how many lines of a file
4 , command instance
1. Display the first n rows of the file
command: Head-n # File | head-# file
[[Email protected]~]# cat-n Test 1 Askdasjkdhsak 2 hkjasd 3 hakjsd 4 HJAKSD 5 Haksdla SDAs 6 Kasdl[[email protected] ~]# head-n 3 test askdasjkdhsakhkjasdhakjsd[[email protected]~]# head-3 test askda Sjkdhsakhkjasdhakjsd[[email protected]~]#
2. except the last 2 lines do not show all other display
command: head-n-# File
[Email protected]~]# head-n-2 test Askdasjkdhsakhkjasdhakjsdhjaksd[[email protected]~]#
3. Display the first n Characters of a file
command: head-c # File
[Email protected]~]# head-c Test Askdasjkdhsakhkjasd[[email protected]~]#
tip: When displaying characters , No line break by default
This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1883539
One day a linux base command view file at the beginning of the content head