What is a Top Command
The top
command is a powerful tool in Linux and Unix environments used for monitoring system usage and performance. It displays a real-time, dynamic view of the processes running on a system, along with information about memory and CPU utilization.
Overview of Top Command
The top
command generates an ordered list of active processes based on user-specified formats and updates it periodically. By default, the ordering is done by CPU usage, and it displays the top CPU consumers. It provides details about how much memory and processing power is being utilized by active processes, helping system administrators detect load on the server.
Implementations of Top Command
There are various versions of the top
command available, with the classical Unix version specified by William LeFebvre. Linux distributions include the top
command as part of the procps-ng
tool group. Microsoft Windows has its graphical Task Manager utility, and IBM AIX includes active processes lists as part of the topas_nmon
and topas
commands.
Options of Top Command
- -a: Solve processes according to allocated memory.
- -b: Begin
top
in batch mode, useful for sending results to other files and programs. - -c: Begin
top
with the last remembered state reversed (‘c’). - -d: Show the delay between screen updates.
- -h: Show the usage prompt and library version, then quit.
- -H: Begin
top
with the last remembered state reversed (‘H’). - -i: Begin
top
with the last remembered state reversed (‘i’). - -m: Report USED (rss process sum and swap count) instead of VIRT.
- -M: Show memory units and display floating-point values in the memory summary.
- -n: Describe the maximum number of frames or iterations before completion.
- -p: Monitor processes with specific process IDs.
- -s: Better managed from the system configuration file.
- -S: List all processes using CPU time in “Cumulative mode.”
- -U: Monitor processes with an effective username or UID matching the provided one.
- -u: Monitor processes with an effective username or UID matching the provided one.
- -v: Show the usage prompt and library version, then quit.
Columns and Fields of Top Command
- PID: Process ID or unique process ID of the task.
- RUSER: Real User Name of the task’s owner.
- PPID: Parent Process PID.
- UID: Effective user ID of the owner.
- USER: Effective username of the owner.
- GROUP: Effective group name of the owner.
- TTY: Controlling terminal name.
- PR: Task’s priority.
- NI: Task’s nice value (negative for higher priority, positive for lower priority).
- P: Last utilized processor.
- TIME: CPU time that the task has utilized since it started.
These columns provide valuable insights into the processes running on the system, aiding administrators in monitoring and managing system resources effectively.