top and pidstat command in Linux

$ top
Display the top processes in your Unix server continusly, until you cancel the command with Ctrl + c

$ top -n 5
Execute the top command 5 times .

$ top -d 10 -n 5
Execute the top command 5 times with 10 secons of delay between each run.

$ top -d 10 -n 5 -o %CPU
Execute the top command 5 times with 10 secons of delay between each run and sort the output by %CPU column.

$ top -d 10 -n 5 -b -o %CPU
If you want to re-direct the output from your top command to a log file or another command, you must use the -b option (Which means Batch Mode).

********************************************************************************

$ pidstat
Or
$ pidstat -p ALL
Display a list of all processes running at that time and the resource that they are using. This command will list all the process from the server, so it could be a long list.

$ pidstat 5 10
Display only process, which are using some resources are that moment. (Not all processes).
The two numbers passed to the command will make it to run 5 times with a delay of 10 seconds between each run.
This report is much better as it shows only process whose use of resources changes between the time interval you have specified.

$ pidstat 5 10 -u -r
Display information about CPU and Memory Usages.
  • -d Report I/O statistics.
  • -r Report page faults and memory utilization.
  • -u Report CPU utilization
$ pidstat -C mySql
Display the resource usage for a specific process

$pidstat -p 1234
Display the resource usage for a specific process Id (PID).

No comments:

Post a Comment

ASM and Database does not auto start in Oracle restart environment (After Server start)

 If you are supporting Any Oracle restart environment and if you notice that your ASM instance and Database instance does not start automati...