Background: Sometimes you need to look at the CPU and occupancy of a process, sometimes you need to look at a single occupancy of the overall process.
I. Linux PS command to view CPU and memory usage of a process
[[email protected] vhost]# PS aux
user pid %cpu %mem vsz RSS TTY STAT START time Command
Explanation:
PS command under Linux
USER Process Run User
pid process number
%CPU process CPU Utilization
%MEM Process memory consumption
The virtual size used by the process of the VSZ
RSS The size of the resident set used by the process or the size of the actual memory
TTY with process-associated terminal (TTY)
STAT Check Status: The process state is represented by a character, such as R (running is running or ready to run), S (sleeping Sleep), I (Idle idle) , Z (Zombie), D (non-disruptive sleep, usually I/O), P (Waiting for a Swap page), W (Swap out, indicates the current page is not in memory), N (Low priority Task) T (terminate termination), W has no resident pages
START (Process start time and date)
times; (Total CPU time used by the process)
Command (command-line command executing)
NI (Nice) Priority
PRI process priority number
PPID process ID for parent process (parent Process ID)
SID session ID)
Wchan the name of the kernel function in which the process is sleeping; the name of the function is obtained from the/root/system.map file.
FLAGS Process-related digital IDs
———————————— The output from the columns above can then be used by awk to output a specific column ————————————
View Plainprint?
- PS aux |grep httpprograme| awk ' {print ( $ "$" "$4" "$11");} '
View a process health parameter for a user o:
- Ps-o User,%cpu,%mem,command
- -o,o user-defined-f full--group--user--pid--cols--ppid
Excerpt from: HTTP://WWW.COMMANDLINEFU.COM/COMMANDS/VIEW/7244/MICRO-PS-AUX-BY-MEMCPU
Second, Linux PS command, view process CPU and memory occupancy rate sort
Use the following command to view:
Ps-aux | sort-k4,4n
PS Auxw--sort=rss
PS Auxw--sort=%cpu
Excerpt from: http://blog.chinaunix.net/uid-21389973-id-3292358.html
Linux PS command, view a process CPU and memory usage situation, Linux PS command, view process CPU and memory occupancy rate sort. Not specified