tail, head and watch Peek, follow, repeat
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
tail -f <file>
tail -n 50 <file>
tail -F <file>
head -n 20 <file>
head -n -5 <file>
tail -n +2 <file>
watch -n 5 <cmd>
watch -d <cmd>
Concepts
- head start of file
- file or stdin
- tail end of file
- live stream new lines
tail
tail <file>
tail -n <N> <file>
tail -n +<N> <file>
tail -c <N> <file>
tail -c +<N> <file>
tail <file1> <file2>
tail -q <file1> <file2>
tail -v <file>
tail -z <file>
Following
tail -f <file>
tail -F <file>
tail -f <file1> <file2>
tail -n 0 -f <file>
tail -f --pid=<pid> <file>
tail --retry -f <file>
tail -f -s <secs> <file>
Ctrl+Chead
head <file>
head -n <N> <file>
head -n -<N> <file>
head -c <N> <file>
head -c -<N> <file>
head <file1> <file2>
head -q <file1> <file2>
head -z <file>
head -n 1watch
watch <cmd>
watch -n <secs> <cmd>
watch -d <cmd>
watch -d=permanent <cmd>
watch -t <cmd>
watch -e <cmd>
watch -g <cmd>
watch -q <cycles> <cmd>
watch -c <cmd>
watch -b <cmd>
watch -p <cmd>
watch -w <cmd>
watch -x <cmd> <args>
Pipes and tee
<cmd> | tail -n <N>
<cmd> | head -n <N>
tail -f <file> | grep --line-buffered
<pat>
<cmd> | tee <file>
<cmd> | tee -a <file>
<cmd> | sudo tee <file>
<cmd> | tee <file1> <file2>
Recipes
tail -F /var/log/nginx/error.log \ | grep --line-buffered -i error
tail -n +2 data.csv | head -n 5
watch -n 1 -d 'ls -l /tmp | tail -n 10'
watch -g -n 2 'systemctl is-active nginx'# exits as soon as the output changes



