In this POST we will learn about the top command output explained in detail.
The top command provides a dynamic real-time view of a running system. It also displays system summary information as well as a list of processes or threads currently being managed by the Linux kernel.
Here is the output of the top command in Linux.
So we have top command output into two categories Summary and Fields Display.
SUMMARY DISPLAY on top command.
We will see the 1st category the Summary Display in the top command output.
1. System time, Up-time and User Sessions
18:40:43 is the current time of the server. up 4 min is the up-time of the server. 2 users are the number of active users.
2. Load Average
The Load Average is the average number of processes that are running or the processes are in the uninterrupted state on the System.
This is the system load average for the past 1 minutes, 5 minutes, and 15 minutes. The 0.52 is the load average of the past 1 minutes, 0.73 is the load average of the past 5 minutes, and 0.36 is the load average of the past 15 minutes.
So the tasks show us the total number of Process and this field can also display the total number of threads running on your server.
I. Total: 165 is the total number of tasks which is running on my server.
II. Running: The process is executing in the CPU or is ready to be executed and we have 1 running task.
III. Sleeping: The process is waiting to complete the event or the process is waiting for the I/O operational to complete and we have 164 sleeping tasks.
IV. Stopped: The process that is stopped by using control+z key known job control signals and we have 0 stopped process in our server.
V. Zombie: The process is the dead process means it finishes the execution but still, there is an entry into the process table as its parent process didn’t call a wait() system call and we have 0 zombie process in our Server.
4. CPU Usage
This will show us the CPU usage in Percentage(%) of the Server.
I. us(User): The time CPU spends on running the User Processes on the server.
II. sy(System): The time CPU spends on running the System process, it is also known as kernel processes.
III. ni(Nice): The time CPU spends on running the priority processes.
IV: id(Idle): The time when CPU is not used, which is known as the idle process.
V: wa(Waiting): Processes that are waiting for the I/O operations in percentage.
VI: hi(Hardware Interrupts): Serving hardware interrupts of CPU in percentage.
VII: si: Serving Software interrupts of CPU in percentage.
VIII: st: It is Steal time, when a part of CPU resources are given to each virtual machine and it does not perform the tasks because the CPU is busy on the other task of VM, that amount or a part is a Steal time.
5. Memory usage
The last two line is of Memory which shows us the “Mem” and “Swap”.
The Mem is the physical memory means a physical RAM in your System.
The Swap is the memory which is taken from the Hard drive if the Physical memory usage is more than some of the not used RAM region has been moved into the Swap Memory.
The “Mem” fields have the total RAM, free RAM in your Server, Used RAM and the buffers/cache utilization.
The “swap” fields have the total swap space, free swap Space and the Used swap space.
FIELDS/Columns DISPLAY on top command.
So this is the main interface where we can identify which process is running, the CPU and Memory Usage of that process, process id, parent process id and command.
So, we look into the another top command output explained in detail.
- PID: This is the Process ID, which is a Unique and a positive integer, help to identify the process.
- USER: Who has started the process which is running on the server, then the kernel assigns the ID to the process.
- PR(Priority): Is the Priority of the process which is running on the server.
- NI(NICE Value): This shows the Nice value of the process. The negative value indicates the Higher Priority and Positive value indicates a Lower Priority.
- VIRT(Virtual Memory): It is the total amount of Virtual memory consumed by a process. It includes all data, code and shared libraries.
- RES(Resident Memory Size): It is the memory consumed by a process in RAM.
- SHR(Shared Memory Size): The amount of shared memory used by a task.
- S(Process Status): It shows us the task status in Single letter like D – uninterruptible sleep, I – Idle, R – running, S – Sleeping, T – Stopped by the job control signal, t – stopped by debugger during the trace, Z – zombie.
- %CPU: Shows the CPU usage in the percentage of the process.
- %MEM: Memory usage in the percentage of the process.
- TIME+: It is the total CPU time the task has used since it is started.
- COMMAND: It displays the name of an associated program.
There are many fields into the top command you can manage these fields by pressing “f” key. you can select or deselect the fields and sort the process by fields.
Find more basic command of Linux