Ps aux in Linux
Ps aux is used to print all processes
Ps is the most basic and powerful process view command
Both aux Parameters
A = show processes for all users display processes of all users
U = display the process's user/owner display the user
X = also show processes not attached to a terminal: displays the process of the uncontrolled terminal.
In the axo to be introduced below
O = format, user-defined
1) Displaying top 10 CPU_consuming processes: displays the top 10 processes that consume the most CPU resources.
# Ps aux | head-1; ps aux | sort-rn + 2 | head-10
2) Displaying top 10 memory-consuming processes: displays the top 10 processes that consume the most memory.
# Ps aux | head-1; ps aux | sort-rn + 3 | head
To view custom columns we use the below command
[Root @ server ~] # Ps axo stat, euser, ruser, % mem, pid, % cpu, comm
Here
Stat-> status of the process
Euser-> valid user
Ruser-> real user
% Mem-> percentage of memory utilized by process
Pid-> process ID
% Cpu-> percentage of memory utilized by process
Comm-> command
To view top 10 memory utilized process
[Root @ server ~] # Ps axo ruser, % mem, comm, pid, euser | sort-nr | head-n 10
RUSER % MEM COMMAND PID EUSER
Root 0.4 sshd 3189 root
Root 0.4 sshd 2486 root
Root 0.2 master 1194 root
Root 0.1 rsyslogd 2918 root
Root 0.1 ps 3355 root
Root 0.1 login 1217 root
Root 0.1 bash 3191 root
Root 0.1 bash 3080 root
Root 0.1 bash 2488 root
To view top 10 memory utilized process
[Root @ server ~] # Ps axo ruser, % cpu, comm, pid, euser | sort-nr | head-n 10
RUSER % CPU COMMAND PID EUSER
Root 0.2 events/0 7 root
Root 0.0 watchdog/0 6 root
Root 0.0 vsftpd 1118 root
Root 0.0 vmmemctl 593 root
Root 0.0 usbhid_resumer 41 root
Root 0.0 udevd 420 root
Root 0.0 udevd 1235 root
Root 0.0 udevd 1234 root
Root 0.0 sync_supers 13 root
This article permanently updates the link address: