If you’re experiencing issues with your Linux server, or simply wish to monitor its performance using the command line, the Linux “top” command is a great tool to try out. Top launches a real-time process monitor that displays system summary information with a list of all running processes and threads.
Log in to your server using SSH and simply enter “top” to launch the monitor.
At the top of the monitor output, you’ll see system summary information. The data includes:
- System Uptime – the current time and length of time since last boot.
- Users – the total number of users logged in to the server.
- Load Averages – system load average over the last one, five, and fifteen minutes.
- Tasks – the number of running tasks or threads, segmented by running, sleeping, stopped, or zombie (terminated or completed but not yet closed) states.
- CPU State – percentage of time based on the following classifications:
- us (user) – user processes that haven’t had their priority changed
- sy (system) – kernel processes
- ni (nice) – user processes that have had their priority changed
- wa (I/O-wai) – time waiting for completion of input/output
- hi – hardware interrupts
- si – software interrupts
- st – time “stolen” from a virtual machine by the hypervisor
- Memory Usage – measured in kibibytes (KiB). Two lines report physical and virtual (swap) memory.
Below the system summary is a list of currently running processes. Each row refers to an individual task with reported data in the adjacent columns, including:
- PID – process ID.
- USER – the process owner.
- PR – priority.
- NI – Nice value.
- VIRT – virtual memory consumption.
- RES – resident memory consumption.
- SHR – shared memory consumption.
- S – process status (D (uninterruptible sleep), R (running), S (sleeping), T (traced or stopped), or Z (zombie).
- %CPU – percentage of CPU time used by the process.
- %MEM – percentage of physical memory used.
- TIME+ – total CPU time (hundredths of a second).
- COMMAND – command name.
You can alter top’s output using the following keystrokes:
- h or ? – display help.
- u – display processing belonging to a particular user.
- k [id] – kill a process with the ID listed.
- s – change the sort order. Select a column with up/down arrow and press s.
- q – quit.
If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.