Sobes.tech
Junior — Middle

Do you work with the 'head' command when executing commands in Linux?

sobes.tech AI

Answer from AI

The head command in Linux is used to display the first lines of a file or data stream. By default, it shows the first 10 lines, but this number can be changed.

Example of usage:

head -n 5 filename.txt

This will display the first 5 lines of the file filename.txt.

You can also use head in pipelines to view the beginning of another command's output:

ps aux | head -n 10

This will display the first 10 processes from the list of all processes.

head is useful for quickly viewing the contents of large files or command outputs without having to load the entire data set.