Unix CPU Usage Command

CPU usage commands
There are several command in Unix to track CPU usage.

top Command:
top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b

Description of 'top' CPU usage command
top provides processor activity in real time. It shows a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for list of processes. Tasks can be sort by CPU usage, memory usage and runtime. In simple words, if you are searching for a real time CPU usage command it's best.
Unix top command

Example:
$ top
$ top -d 5         //delay 5 minute
                         //press M to see memory usage

1. Kill task with top command
When top command is running Press k and enter PID and press enter key to kill that task.
Kill task when top command is running
2. Display Selected User in Top Output
Use top -u to display a specific user processes only in the top command output.
$ top -u root

3. Try some more interesting options of top command
$ top -p 1523, 1652          //Display only specific process (PID)
$ top //Press 1 to display CPUs cores in top output
         //Press space bar to change refresh delay
Change delay from 3.0 to: 10

1 comment: