Search⌘ K
AI Features

Viewing Beginning and Ending Contents of Files

Explore how to use the head and tail commands in Bash to view the beginning and ending contents of files. Understand key options for specifying the number of lines or bytes to display, and learn practical examples for working with multiple files.

We can use head and tail to view beginning and ending contents of file.

head:

Definition:

head, by default, prints the first 10 lines of each file to standard output. It reads the first few lines of any text given to it as an input and writes them on the display screen.

Syntax:

head [options] [file(s)]

...