EX200 · Question #18
18. Create a system monitoring script Create a script named systeminfo. The script must be located in /usr/local/bin. The script is used to obtain information about the current system processes. It…
The correct answer is A. See the below explanation. Explanation/Reference: [root@node1 ~]# vim /usr/local/bin/systeminfo ps -xao user,pid,vsz,rss,%cpu --sort=pcpu ps -xao user,pid,vsz,rss,%cpu | sort -fnk 5 [root@node1 ~]# chmod +x /usr/local/bin/systeminfo [root@node1 ~]# systeminfo Explanation of ps -xao: x - Display processes…
Question
- Create a system monitoring script Create a script named systeminfo. The script must be located in /usr/local/bin. The script is used to obtain information about the current system processes. It must output the following process information in order: Process owner Virtual memory usage Resident (physical) memory usage CPU usage percentage The output must be sorted by CPU usage percentage, with the process that consumes the most CPU displayed last.
Options
- ASee the below explanation
How the community answered
(41 responses)- A100% (41)
Explanation
Explanation/Reference: [root@node1 ~]# vim /usr/local/bin/systeminfo ps -xao user,pid,vsz,rss,%cpu --sort=pcpu ps -xao user,pid,vsz,rss,%cpu | sort -fnk 5 [root@node1 ~]# chmod +x /usr/local/bin/systeminfo [root@node1 ~]# systeminfo Explanation of ps -xao: x - Display processes without a controlling terminal, and show the full path of each command a - Display all processes associated with a terminal, except session leaders o - User-defined output format
Topics
Community Discussion
No community discussion yet for this question.