MONITOR YOUR SYSTEM WITH THE TOP COMMAND

The top command is a useful command-line tool that lets you get system statistics at a glance and monitor your system in real time. It displays your current uptime and load average and the number of running processes (including the number of sleeping processes, zombie processes, and stopped processes). It also shows you the state of your CPU by telling you how much CPU power is idle and how much the system or users are using.

Additionally, it displays your memory and swap usage.

The top command also provides information on various processes. It can show you the Process ID of the process, which user is running the process, the amount of memory the process is using, its state, the percentage of CPU, and how long it has run.

By default, top sorts the process list by CPU usage; however, you can use interactive commands to tell top to sort processes by memory usage or time. You can also toggle a number of the displays and even use top to kill processes. The following is a brief summary of some of the commands you can use with top:


P Sorts by CPU usage


M Sorts by resident memory usage


T Sorts by time and cumulative time


m Toggles display of memory information


t Toggles display of processes and CPU state information


k Kills a process by prompting for PID and signals to send


W Writes current setup to ~/.toprc to make it the default for ubsequent top usage