head
output the first part of files
or
supress the end of the file.

head [OPTION]... [file]

Output the first lines of each file to standard output.
With more than one file, precede each with a header giving the file name.
With no file, or when file is -, read standard input.
-n [-]N
--lines=[-]N
output the first N lines, default 10
with the leading - output all but the last N lines of each file
(with tail use + to skip the beginning)
cat sixlines
1
2
3
4
5
6
head -n 2 sixlines
1
2
head -n -2 sixlines
1
2
3
4
N may have a multiplier suffix: blocks 512, k 1024, m 1024*1024.
-c [-]N
--bytes=[-]N
output the first N characters/bytes of each file;
with the leading '-', output all but the last N bytes of each file
-q
--quiet
--silent
never output headers giving file names
-v
--verbose
always output headers
--help
--version


tail [OPTION]... [file]

Output the last lines of each file to standard output, default 10.
With more than one file, precede each with a header giving the file name.
With no file, or when file is -, read standard input.
-n [+]J[S]
--lines=[+]J[S]
output the last J lines
Use -n +J to output lines starting with the Jth
cat sixlines
1
2
3
4
5
6
tail -n2 sixlines
5
6
tail -n +2 sixlines
2
3
4
5
6
S multiplier suffix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.
-c [+]J
--bytes=J
output the last J characters / bytes;
use -c +J to output bytes starting with the Jth character of each file
-f
--follow[={descriptor|name}]
output appended data as the file grows.
Useful for watching the log file of a running process.
-f, --follow, and --follow=descriptor are equivalent
defaults to following the file descriptor, which means that even if a tail'ed file is renamed, tail will continue to track it.
This is not desirable when tracking the actual name of the file, (for example: log rotation).
Use --follow=name in that case which tracks the named file in a way that accommodates renaming, removal and creation.
--pid=PID with -f, terminate after process ID, PID dies
--retry keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name
-F same as --follow=name --retry
-s S
--sleep-interval=S
with -f, sleep for s seconds (default 1.0) between iterations.
--max-unchanged-stats=N with --follow=name, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed
(this is the usual case of rotated log files).
With inotify, this option is rarely useful.
-q
--quiet
--silent
never output headers giving file names
With inotify, this option is rarely useful.
-v
--verbose
always output headers giving file names
--help
--version