the first one head gives the first ten lines of a file for instance:
head /etc/passwd
outputs:
root
bin
deamon
adm
lp
sync
shutdown
halt
the secon
root
bin
deamon
adm
lp
d one: tail gives the last ten words of a file to use a similar example:
tail /etc/passwd
outputs:
avahi
tcpdump
jelkner
student
systemd-bus-proxy
systemd-network
geoclue
setroubleshoot
jjohnson
hrodriguez
now people dont always want just the first or last ten words in a line. sometimes they want the first/last four or first/last twenty seven. to do this we use the:
-N parameter
the -n parameter tells the computer how many lines you want it to output for instance:head -n 5 /etc/passwd
gives you:
root
bin
deamon
adm
lp
or
tails -n 15 /ect/passwd
gives you:
pulse
gdm
gnome-initial-setup
postfix
sshd
avahi
tcpdump
jelkner
student
systemd-bus-proxy
systemd-network
geoclue
setroubleshoot
jjohnson
hrodriguez
No comments:
Post a Comment