Top command usages and examples in Unix/Linux

Top command has an important role in Unix/Linux Administration side. The command “top” displays a dynamic view of process that are currently running under the system. Here I’m  explaining some of the useful usage of top command for My Admin Friends.
Top command is simple in usage and very interesting also. The simple top command output is shown below.

1. top
top

An important thing is we can observer the dynamic view of Load Average from “top” command and also uptime, total users logged in to the system, cpu & free memory details etc..

2. -d switch with top command
d means delay time. The syntax for ‘d’ is “top -d ss.tt”(seconds.tenths).
For example top -d 05.00 that means the top command’s output screen have a dynamic change with 5 second time interval.

3. top command’s output field description.

PID : Process ID.
USER : The user name who runs the process.
PR : Priority
NI : Nice value
%CPU : CPU usage
TIME : CPU Time
%MEM : Memory usage (RES)
VIRT : Virtual Image (kb)
SWAP : Swapped size (kb)
RES : Resident size (kb)
S : Process Status
The status of the task which can be one of:
'D' = uninterruptible sleep
'R' = running
'S' = sleeping
'T' = traced or stopped
'Z' = zombie

4. Interactive commands for top
Several single-key commands are recognized while top is running.
4.1 space

Immediately updates the display.

4.2 h or ?

This will display the help page (q for quit).

4.3 k :

For kill a process.

kill

In the image change PROCESS ID with the pid of process which you want to kill.
4.4 i

Ignore idle and zombie processes. This is a toggle switch.

4.5 I (shift i)

Toggle between Solaris (CPU percentage divided by total number of CPUs) and Irix (CPU percentage calculated solely by amount of time) views. This is a toggle switch that affects only SMP systems.

4.6 n or #

Change the number of processes to show. You will be prompted to enter the number. This overrides automatic determination of the number of processes to show, which is based on window size measurement. If 0 is specified, then top will show as many processes as will fit on the screen; this is the default.

4.7 q

Quit.

4.8 M (shift m)

sort tasks by resident memory usage.

mem

4.9 T (shift t)

sort tasks by time / cumulative time.

time

4.10 c or P(shift p)

sort tasks by CPU usage (default).

cpu

4.11 A (shift a)

sort tasks by age (newest first).

age

4.12 N (shift n)

sort tasks by pid (numerically).

pid

These are some interesting usage of top command under UNIX/LINUX. Please let me know your suggestions by commending. Thank you for your time.

More:
groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

9 Responses

  1. Dhavamani says:

    this article is too informative

  2. Ashy says:

    http://crybit.com/ps-command-with-example-unixlinux/

    The website is very user friendly and is very useful.
    Thank you 🙂

  1. October 10, 2013

    […] Unix/Linux displays the screen shots of current process. This is actually the static out put of the top command. Some useful ps commands switch combinations and examples are explained below, 1. ps aux […]

  2. December 23, 2013

    […] TOP command is used to display a dynamic view of all process running under the server. We already discussed about the TOP command and some of its examples. Click here for getting more details about Top command usages and examples in Unix/Linux […]

  3. January 18, 2014

    […] command” and “top command” have a lot of options, here I am explaining some useful command combinations to find the […]

  4. February 1, 2014

    […] topics: The tail command iftop command find command switches with example Top command PS command usages with […]

  5. March 14, 2014

    […] Top command usages and examples in Unix/Linux | CryBit […]

Leave a Reply

Your email address will not be published. Required fields are marked *