May 2017
Beginner
552 pages
28h 47m
English
The CPU usage data is generated by the first loop that runs for one hour (3600 seconds). Once each minute, the ps -eocomm,pcpu command generates a report on the system activity at that time. The -e option specifies to collect data on all processes, not just this session's tasks. The -o option specifies an output format. The comm and pcpu words specify reporting the command name and percentage of CPU, respectively. This ps command generates a line with the command name and current percentage of CPU usage for each running process. These lines are filtered with grep to remove lines where there was no CPU usage (%CPU is 0.0) and the COMMAND %CPU header. The interesting lines are appended to a temporary file.
The temporary file ...