Tuesday 12 August 2014

top and htop commands in Linux

        Linux provides utilities called top and htop to monitor the real time processes. They displays the dynamic real-time view of the running system. But, both the command are quite different in action.
Top command displays the Linux processes. It can display system summary information and processes or threads currently managed by the kernel.  When we type top in terminal we get the currently running process as shown in Fig 1.


                                              Fig 1:top  displaying running processes

Even though htop is quite similar to top there are some extra features that makes htop better command utility than top. The htop utility is not already built in Linux, it should be downloaded and installed. Once it is installed  it can be run through command line by just typing 'htop' (We can install it by just typing sudo apt-get install htop)

The Fig 2 shows the htop window look like,

                                                          Fig 2 :htop window


Now let's see what htop displays,

The top left corner:
The numbers 1,2,3 and 4 represents the number of cores in the system. The bars next to these numbers shows the loads on the cores. The colour difference in the bars represent different information. Below that lies memory and swap information.

The top right corner:
Here information related to  loads, threads, load average and up time are displayed. Load average is the amount of work that system does. Here in my system load average is 0.34 which means very less load on CPU. If it goes up to 2 it means that system is making use of CPU 100%.

Process related information:
The information about each process is divided into columns. The explanation of each column is as follows:


     PID: Process ID of a process
    USER: User owning the process
    PR: Priority of the process.
    NI: The nice value for a process.
    VIRT: Virtual memory consumption.
    RES: Physical RAM consumption in kilobytes.
    SHR: Shared memory consumption.
    S: Process status (sleeping, running etc).
    CPU%: CPU consumption
    MEM%: Physical RAM consumption.
    TIME+: Processor time used by the process.
    COMMAND: Command that started the process.

Htop provides many features to customize it according to user's taste. At the bottom of the htop window we can see F-keys and its function written next to them.

No comments:

Post a Comment