We use TOP command for monitoring the CPU utilization of our system. Running from a command line we can view information regarding CPU and memory usage, the number of running processes, load. Here is the output of the top command…..
Now if we want some system administration utility run and collect system information and write it to a log file periodically. we can do it via crontab or a script.
But i have a better and much simpler solution to do this job.
# top -b -d 5 -n 4 >> top_log_file
-b —- top running in batch mode
-d —– delay (refresh after 5 seconds and default is 3 seconds).
-n — number of iterations.
we will get a log file named “top_log_file”
# vim top_log_file
so this is how we can run top command in batch mode also for administrative purpose.
Be the first to comment.