Linux

head

I was asked by one of my friends, how he could get the top 10 processes in a Unix system. I knew of the usual commands “top”and “ps” and never thought of how you could just get the top 10. Interestingly there is a command called “head“. So if you wanted the top 10 processes you would use “ps -auxw | head“. “man head” returns the following

NAME
head – output the first part of files

SYNOPSIS
head [OPTION]… [FILE]…

DESCRIPTION
Print first 10 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.