The head and tail commands display the beginning and end of a file respectively. By default, these commands display 10 lines, but they both have a –n option that allows a different number of lines to be specified. The file to display is passed as an argument to these commands.
Head command shows the first 10 lines of a file
[root@CentOs ~]# head /etc/passwd
Tail command shows the last 10 lines of a file
[root@CentOs ~]# tail /etc/passwd
Head command with -n option
[root@CentOs ~]# head -n 5 /etc/passwd
For more options see head man page
Tail command with -n option
[root@CentOs ~]# tail -5 /etc/passwd
Tech info |
Comments
Post a Comment