You can directly use the top command to view the contents of %MEM. You can choose to view by process or by user. If you want to view the process memory usage of oracle users, you can use the following command:
(1)top
The top command is a commonly used performance analysis tool under Linux, which can display the resource occupancy status of each process in the system in real time, similar to the Windows task manager
You can directly use the top command to view the contents of %MEM. You can choose to view by process or by user. If you want to view the process memory usage of oracle user, you can use the following command:
$ top -u oracle
Content explanation:
PID: Process ID
USER: Process owner
PR: Process priority level, the smaller the priority is to be executed
NInice: Value
VIRT: The virtual memory
occupied by the process RES: The physical memory occupied by the process
SHR: The shared memory used by the
process S: The process status. S means sleeping, R means running, Z means dead state, N means that the priority value of the process is negative
%CPU: The usage rate of CPU occupied by the process
%MEM: The percentage of physical memory and total memory used by
the process TIME+: After the process starts The total occupied CPU time, that is, the accumulated value of the occupied CPU usage time.
COMMAND: Process startup command name
Common commands:
P: Ranked by %CPU usage
T: Ranked by MITE+
M: Ranked by %MEM
(2)pmap
You can view the memory occupied by process-related information according to the process, (the process number can be viewed through ps) as follows:
$ pmap -d 14596
(3)ps
如下例所示:
$ ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' 其中rsz是是实际内存
$ ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep oracle | sort -nrk5
其中rsz为实际内存,上例实现按内存排序,由大到小
示例:
1.CPU占用最多的前10个进程:
ps auxw|head -1;ps auxw|sort -rn -k3|head -10
2.内存消耗最多的前10个进程
ps auxw|head -1;ps auxw|sort -rn -k4|head -10
3.虚拟内存使用最多的前10个进程
ps auxw|head -1;ps auxw|sort -rn -k5|head -10