Here are some frequently used command line monitoring tools. These commands are available under all distributions of Linux
top
$ top
The top command is used to dipslay all the running and active real-time processes in an ordered list and updates it regularly. It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processes.
This list can frequently change, as background tasks start and complete.
One helpful switch is to launch top with the–i switch:
top –i
This hides all the idle processes, making it easier to sort through the list.
To quit the top function, press the letter q on your keyboard.
Some other useful commands while top is running include: M – sort task list by memory usage P – sort task list by processor usage N – sort task list by process ID T – sort task list by run time
To get assistance with top you can press the letter h while it’s running. Or, you can enter the following at a command line:
man top This will display the manual page for the top command.
vmstat
$ vmstat
The vmstat command will display statistics about system processes, memory, swap, I/O, and the CPU performance.
These statistics are generated using data from the last time the command was run to the present.
In case the command never being run, the data will be from the last reboot to the current time. On multiple CPU systems, vmstat averages the number of CPUs into the output.
The vmstat command updates its output like top command and can be executed like below.
The following command will update its report every 5 seconds until there is an interrupt.