Sometimes you don’t want to print everything in a file. Files can be really big after all.
head Command
The head command prints the first n lines of a file. The -n flag specifies n as shown:
head -n 10 file1.txtIf you don’t specify a number using the -n flag, it will default to 10 in Learn Linux
tail Command
The tail command prints the last n lines of a file. The -n flag specifies n as shown in Learn Linux :
tail -n 10 file1.txt