Every system administrator (and most of users) knows the command that allows to get a snapshot of current server state. Today I will teach you how to take the most of this command.
Here is how the default output of top command looks like:
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
First information block delivers information about server uptime, and average load data. It’s identical to uptime command.
The second block represents the process information. To view detailed information about processes that are currently running, press c. The output should look like this:
In order to view all processes of a certain user, you should press u on the top default view. A prompt string will appear asking for user name. I have entered apache in the prompt.
In order to sort processes by memory consumption, press m on the top view.
In order to kill a task without leaving top output window, press k. You will be asked for PID to kill:
For core load information, press 1 (number one) to view detailed information on all CPUs installed:
In order to highlight all processes are currently running, press z or b
Hope these different options will help you to detect all the information about your server you’re interested in. top command is more powerful than you think.