ps | Cheatsheet¶
ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use top instead.
Show cpu usage¶
Show mem usage¶
The columns that are displayed can be customized¶
To view all processes on the system¶
View the above processes, but with more excruciating details:¶
ASCII tree linking parent and child processes.¶
To view details of a specific process using its PID, say 9999:¶
Top 10 Memory Processes (reduced output to applications and %usage only)¶
processes per user counter¶
Top CPU consuming processes with ps
¶
See all processes running by user¶
Display the top ten running processes - sorted by memory usage¶
Show a 4-way scrollable process tree with full details.¶
Show a 4-way scrollable process tree with full details.¶
Hide the name of a process listed in the ps
output¶
count processes with status¶
easily strace all your apache processes¶
Threads and processes of a user¶
Show total cumulative memory usage of a process that spawns multiple instances of itself¶
print a cpu of a process¶
Sort all processes by the amount of virtual memory they are using¶
mem leak check¶
Shortcut to search a process by name¶
Display the top ten running processes - sorted by memory usage¶
Display CPU usage in percentage¶
easily strace all your apache processes¶
kill defunct processes by killing their parents¶
Find the uid and gid of your apache process¶
ps -o euid,egid ppid `netstat inet inet6 -pln|awk '/:80 / { split($7,tmp, "/"); print tmp[1]; }'`|sort |uniq|grep -v EUID
Get to the user for using system.¶
Get pid of running Apache Tomcat process¶
kill all instances of an annoying or endless, thread-spawning process¶
Search for a running process through grep¶
find and kill a pid for APP¶
Search for a process by name¶
Killing multiplpe process for one program like apache, wget, postfix etc.¶
Killing multiplpe process for one program like apache, wget, postfix etc.¶
Find the correct PID¶
count how many cat processes are running¶
count how many cat processes are running¶
Display the top ten running processes - sorted by memory usage¶
Figure out what shell you're running¶
Shows users and 'virtual users' on your a unix-type system¶
Kill process by searching something from 'ps' command¶
Kill process by searching something from 'ps' command¶
Kill a process with its name¶
Find the process you are looking for minus the grepped one¶
Check processes runed not by you¶
Kill all Zombie processes one-liner¶
omit grep¶
kills all processes for a certain program e.g. httpd¶
find a process id by name¶
Kill a bunch of processes with the same name¶
Count the total number of files in each immediate subdirectory¶
search for and kill a process in one blow¶
Kill any process with one command using program name¶
CPU/MEM and Top 10 processes¶
ps -eo user,pcpu,pmem | tail -n +2 | awk '{num[$1]++;
cpu[$1] += $2; mem[$1] += $3} END{printf("NPROC\tUSER\tCPU\tMEM\n");
for (user in cpu) printf("%d\t%s\t%.2f\t%.2f\n",num[user], user, cpu[user], mem[user]) }'
This is a nice way to kill processes.¶
kill all instances of an annoying or endless, thread-spawning process¶
Kill all processes matching a given name¶
Pretty print output of¶
ps -ef | awk -v OFS="\n" '{ for (i=8;i<=NF;i++) line = (line ? line FS : "") $i; print NR ":", $1, $2, $7, line, ""; line = "" }'
List running procceses¶
Search for a process by name¶
Display the top ten running processes - sorted by memory usage¶
easily strace all your apache processes¶
View and review the system process tree.¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
See how many % of your memory firefox is using¶
Find the process you are looking for minus the grepped one¶
Display the top ten running processes - sorted by memory usage¶
Find the process you are looking for minus the grepped one¶
Display the top ten running processes - sorted by memory usage¶
total percentage of memory use for all processes with a given name¶
Restart command if it dies.¶
Display the top ten running processes - sorted by memory usage¶
processes per user counter¶
Display the top ten running processes - sorted by memory usage¶
Top ten (or whatever) memory utilizing processes (with children aggregate)¶
ps axo rss,comm,pid | awk '{ proc_list[$2]++; proc_list[$2 "," 1] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc "," 1],proc); }}' | sort -n | tail -n 10
Display the top ten running processes - sorted by memory usage¶
List processes sorted by CPU usage¶
How much RAM is Konsole using?¶
count and number lines of output, useful for counting number of matches¶
Tells the shell you are using¶
Who invoked me? / Get parent command¶
Display the top ten running processes - sorted by memory usage¶
ps a process keeping the header info so you know what the columns of numbers mean!¶
List all databases in Postgres and their (byte/human) sizes, ordering by byte size descending¶
psql -c "SELECT pg_database.datname, pg_database_size(pg_database.datname), pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;" -d <ANYDBNAME>
Find the processes that are on the runqueue. Processes with a status of¶
Display the top ten running processes - sorted by memory usage¶
Format ps command output¶
Display the top ten running processes - sorted by memory usage¶
ps with parent/child process tree¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
Output Detailed Process Tree for any User¶
Displays process tree of all running processes¶
Print current running shell, PID¶
Pulls total current memory usage, including SWAP being used, by all active processes.¶
Show the 20 most CPU/Memory hungry processes¶
Current running process ordered by %CPU¶
To find the uptime of each process-id of particular service or process¶
ps -o etime `pidof firefox` |grep -v ELAPSED | sed 's/\s*//g' | sed "s/\(.*\)-\(.*\):\(.*\):\(.*\)/\1d \2h/; s/\(.*\):\(.*\):\(.*\)/\1h \2m/;s/\(.*\):\(.*\)/\1m \2s/"
processes per user counter¶
Pull Total Memory Usage In Virtual Environment¶
ps axo rss,comm | awk '{sum+=$1; print $1/1024, "MB - ", $2} END {print "\nTotal RAM Used: ", sum/1024, "MB\n"}'
Find processes utilizing high memory in human readable format¶
ps -eo size,pid,user,command sort -size |awk '{hr[1024**2]="GB";hr[1024]="MB";for (x=1024**3; x>=1024; x/=1024){if ($1>=x){printf ("%-6.2f %s ", $1/x, hr[x]);break}}}{printf ("%-6s %-10s ", $2, $3)}{for (x=4;x<=NF;x++){printf ("%s ",$x)} print ("\n")}'
Getting ESP and EIP addresses from running processes¶
Return threads count of a process¶
Figure out what shell you're running¶
Kill all processes belonging to a user¶
List all PostgreSQL databases. Useful when doing backups¶
Show the command line for a PID with ps¶
Check ps output to see if file is running, if not start it¶
easily strace all your apache child processes¶
easily strace all your apache processes¶
count how many cat processes are running¶
Chrome sucks¶
ps -e -m -o user,pid,args,%mem,rss | grep Chrome | perl -ne 'print "$1\n" if / (\d+)$/' | ( x=0;while read line; do (( x += $line )); done; echo $((x/1024)) );
Sort output by column¶
lazy SQL QUERYING¶
List PHP-FPM pools by total CPU usage¶
ps axo pcpu,args | awk '/[p]hp.*pool/ { sums[$4] += $1 } END { for (pool in sums) { print sums[pool], pool } }' | sort -rn | column -t
Shows users and 'virtual users' on your a unix-type system¶
find duplicate processes¶
Top ten memory hogs¶
"What the hell is running on?!" Easily snoop your system's RAM consumption¶
Top 10 Memory Consuming Processes¶
get some information about the parent process from a given process¶
Chrome sucks¶
Count threads of a jvm process¶
the executable that started the currently running oracle databases and the ORACLE_HOME relative to each¶
ps -ef |grep oracle |grep pmon |awk '{print $2}' |xargs -I {} ps eww {} |grep pmon |grep -v grep |awk '{print $5 " " $6 " " $0}' |sed 's/\(S*\) \(S*\) .*ORACLE_HOME/\1 \2/g' |cut -f1,2,3 -d" "
print a cpu of a process¶
Search for an active process without catching the search-process¶
Nicely display mem usage with ps¶
See OpenVZ Container id's of top 10 running processes by %cpu¶
Find processes stuck in dreaded "D" state aka IO Wait¶
List process in unkillable state D (iowait)¶
cpu and memory usage top 10 under Linux¶
ps -eo user,pcpu,pmem | tail -n +2 | awk '{num[$1]++; cpu[$1] += $2; mem[$1] += $3} END{printf("NPROC\tUSER\tCPU\tMEM\n"); for (user in cpu) printf("%d\t%s\t%.2f%\t%.2f%\n",num[user], user, cpu[user], mem[user]) }'
View Processeses like a fu, fu¶
kill all running instances of wine and programs runned by it (exe)¶
Given process ID print its environment variables¶
'micro' ps aux (by mem/cpu)¶
Find the process you are looking for minus the grepped one¶
Find the process you are looking for minus the grepped one¶
Search for a process by name¶
kill all foo process¶
Given $PID, print all child processes on stdout¶
Remove grep itself from ps¶
Display top 5 processes consuming CPU¶
Show CPU usage for EACH cores¶
grep processes list avoiding the grep itself¶
Transfer a file to multiple hosts over ssh¶
easily strace all your apache processes¶
Top ten (or whatever) memory utilizing processes (with children aggregate) - Can be done without the multi-dimensional array¶
ps axo rss,comm,pid | awk '{ proc_list[$2] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' | sort -n | tail -n 10
memory usage¶
Sort all running processes by their memory & CPU usage¶
Kill all processes belonging to a user¶
Discover the process start time¶
List users with running processes¶
psgrepp¶
count how many cat processes are running¶
find out zombie process¶
ps grep with header¶
List Threads by Pid along with Thread Start Time¶
Run a script in parrallel over ssh¶
Chrome sucks¶
Chrome sucks¶
Find a process by name and automatically kill it¶
Get the name or user running the process of specified PID¶
count and number lines of output, useful for counting number of matches¶
Show WebSphere AppServer uid|pid|cell|node|jvms¶
ps -ef | grep [j]ava | awk -F ' ' ' { print $1," ",$2,"\t",$(NF-2),"\t",$(NF-1),"\t",$NF } ' | sort -k4
Display the specified range of process information¶
all users with terminal sessions¶
kill all process that belongs to you¶
NOTHING TO KILL"; fi; cat .tmpkill; rm .tmpkill;¶
ps -u $USER -lf | grep -vE "\-bash|sshd|ps|grep|PPID" > .tmpkill; if (( $(cat .tmpkill | wc -l) > 0 )); then echo "
psgrep(command)¶
Sum using awk¶
Display the top ten running processes - sorted by memory usage¶
Get a PostgreSQL servers version¶
get process id with program name¶
Display all zombie process IDs¶
Get a PostgreSQL servers version¶
printing with psnup¶
Using psnup to get two pages per page¶
Kill all Zombie processes one-liner¶
Display the top ten running processes - sorted by memory usage¶
total percentage of memory use for all processes with a given name¶
Grep without having it show its own process in the results¶
processes per user counter¶
'micro' ps aux (by mem/cpu)¶
Count total processes for specific program and user¶
Display the top ten running processes sorted by the memory usage:¶
Get the number of open sockets for a process¶
To get the average httpd process size, log into your server and run the following on the command line¶
If you want to calculate the average on-the-fly¶
ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'
find the full amount of ram associated with mysql¶
Find the processes that are on the runqueue. Processes with a status of¶
Total procs, avg size (RSS) and Total mem use¶
ps awwwux | grep httpd | grep -v grep | awk '{mem = $6; tot = $6 + tot; total++} END{printf("Total procs: %d\nAvg Size: %d KB\nTotal Mem Used: %f GB\n", total, mem / total, tot / 1024 / 1024)}'
Display the top ten running processes - sorted by memory usage¶
Given $PID, print all child processes on stdout¶
Find longest running non-root processes on a machine¶
ps -eo etime,pid,pcpu,ppid,args | sed -e '/\[.\+\]/d' -e '/^[ \t]*[0-9]\{2\}:[0-9]\{2\} /d' | sort -k1r
Display the top ten running processes - sorted by memory usage¶
Find all processes running under your username.¶
list java heap summary¶
List user processes with their memory usage and total usage.¶
Figure out what shell you're running¶
Kill all processes belonging to a user¶
check memory and CPU consumption of Process on node.¶
show top 10 most memory hungry process with a simple format of (%mem, pid, short command)¶
Exclude grep from your grepped output of ps (alias included in description)¶
Sum of the total resident memory Stainless.app is using.¶
Show concurrent memory usage for individual instances of an application¶
Thread count per user¶
Kill processes associated with PATTERN¶
Find processes by current user on a Solaris box¶
Kill a lot of process once a time¶
Display the top ten running processes - sorted by memory usage¶
Get the name or user running the process of specified PID¶
Grep the process excluding the grep itself.¶
the executable that started the currently running oracle databases and the ORACLE_HOME relative to each¶
ps -ef | grep [p]mon | awk '{print $2}' | xargs -I {} ps eww {} | awk '{print $1 " " $5 " " $6 " " $0}' | sed 's/\(S*\) \(S*\) .*ORACLE_HOME/\1 \2/g' | cut -f1,2,3 -d" "
Processes by CPU usage¶
Basic search for Quassel PostgreSQL database¶
psql -U quassel quassel -c "SELECT message FROM backlog ORDER BY time DESC LIMIT 1000;" | grep my-query
Get thread count for process on Solaris¶
Find which process is using a port on Solaris¶
ps -ef | grep user | awk '{print $2}' | while read pid; do echo $pid ; pfiles $pid| grep portnum; done
postgresql : drop all tables from a schema¶
psql -h <pg_host> -p <pg_port> -U <pg_user> <pg_db> -t -c "select 'drop table \"' || tablename || '\" cascade;' from pg_tables where schemaname='public'" | psql -h <pg_host> -p <pg_port> -U <pg_user> <pg_db>
postgresql : drop all sequences from the public schema¶
psql -h <ph_host> -p <pg_port> -U <pg_user> <pg_db> -t -c "select 'drop sequence \"' || relname || '\" cascade;' from pg_class where relkind='S'" | psql -h <ph_host> -p <pg_port> -U <pg_user> <pg_db>
Command to kill PID¶
ps auxww | grep application | grep processtobekilled | gawk '{print $2}' | grep -v grep | xargs kill -9
cpu process limitation for specific processname like java,kibana¶
ps auxf | grep -v grep | grep -E -i "java|kibana" | awk {'print $2'} | while read pid; do cpulimit -l 25 -b -p $pid > /tmp/cpulimit_$pid ;done
Sum of RSS utilization in Linux¶
count processes with status¶
ps axu | awk '{if (NR <=7) print; else if ($8 == "D") {print; count++} } END {print "Total status D: "count}'
Total Apache memory¶
all out¶
psg (ps grep) function if you don't have pgrep or don't know how to use it¶
psg() { if [ -z "$2" ]; then psargs="aux"; greparg="$1"; else psargs="$1"; greparg="$2"; fi; ps $psargs | grep -i "$(echo $greparg | sed -e 's/^\(.\)/[\1]/')\|^$(ps $psargs | head -1)" ; }
the executable that started the currently running oracle databases and the ORACLE_HOME relative to each¶
ps -ef |grep oracle |grep pmon |awk '{print $2}' |xargs -I {} ps eww {} |grep pmon |grep -v grep |awk '{print $5 " " $6 " " $0}' |sed 's/\(S*\) \(S*\) .*ORACLE_HOME/\1 \2/g' |cut -f1,2,3 -d" " 2010-03-23 20:36:59 User:
Get a PostgreSQL servers version¶
psql -h <SERVER NAME HERE> -c 'SELECT version();' | grep -v 'version\|-\|row\|^ *$' | sed 's/^\s*//'
Look for process by filename in command then kill the process¶
ram usage most top 10 process¶
Create a booklet ps file out of a normal ps (A4 Size)¶
Display the top ten running processes - sorted by memory usage¶
Show a 4-way scrollable process tree with full details.¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
cpu and memory usage top 10 under Linux¶
ps -eo user,pcpu,pmem | tail -n +2 | awk '{num[$1]++; cpu[$1] += $2; mem[$1] += $3} END{printf("NPROC\tUSER\tCPU\tMEM\n"); for (user in cpu) printf("%d\t%s\t%.2f\t%.2f\n",num[user], user, cpu[user], mem[user]) }'
Display the top ten running processes - sorted by memory usage¶
easily strace all your apache processes¶
View and review the system process tree.¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
See how many % of your memory firefox is using¶
Find the process you are looking for minus the grepped one¶
Display the top ten running processes - sorted by memory usage¶
Find the process you are looking for minus the grepped one¶
Display the top ten running processes - sorted by memory usage¶
total percentage of memory use for all processes with a given name¶
Restart command if it dies.¶
Display the top ten running processes - sorted by memory usage¶
processes per user counter¶
Display the top ten running processes - sorted by memory usage¶
Top ten (or whatever) memory utilizing processes (with children aggregate)¶
ps axo rss,comm,pid | awk '{ proc_list[$2]++; proc_list[$2 "," 1] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc "," 1],proc); }}' | sort -n | tail -n 10
display date of last time a process was started in date
format¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
Apache memory usage¶
List processes sorted by CPU usage¶
How much RAM is Apache using?¶
count and number lines of output, useful for counting number of matches¶
Tells the shell you are using¶
Who invoked me? / Get parent command¶
Display the top ten running processes - sorted by memory usage¶
ps a process keeping the header info so you know what the columns of numbers mean!¶
List all databases in Postgres and their (byte/human) sizes, ordering by byte size descending¶
psql -c "SELECT pg_database.datname, pg_database_size(pg_database.datname), pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;" -d <ANYDBNAME>
Find the processes that are on the runqueue. Processes with a status of¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
ps with parent/child process tree¶
Display the top ten running processes - sorted by memory usage¶
Display the top ten running processes - sorted by memory usage¶
Output Detailed Process Tree for any User¶
Displays process tree of all running processes¶
Print current running shell, PID¶
Pulls total current memory usage, including SWAP being used, by all active processes.¶
Show the 20 most CPU/Memory hungry processes¶
Current running process ordered by %CPU¶
To find the uptime of each process-id of particular service or process¶
ps -o etime `pidof firefox` |grep -v ELAPSED | sed 's/\s*//g' | sed "s/\(.*\)-\(.*\):\(.*\):\(.*\)/\1d \2h/; s/\(.*\):\(.*\):\(.*\)/\1h \2m/;s/\(.*\):\(.*\)/\1m \2s/"
processes per user counter¶
Pull Total Memory Usage In Virtual Environment¶
ps axo rss,comm | awk '{sum+=$1; print $1/1024, "MB - ", $2} END {print "\nTotal RAM Used: ", sum/1024, "MB\n"}'
Find processes utilizing high memory in human readable format¶
ps -eo size,pid,user,command sort -size |awk '{hr[1024**2]="GB";hr[1024]="MB";for (x=1024**3; x>=1024; x/=1024){if ($1>=x){printf ("%-6.2f %s ", $1/x, hr[x]);break}}}{printf ("%-6s %-10s ", $2, $3)}{for (x=4;x<=NF;x++){printf ("%s ",$x)} print ("\n")}'
Getting ESP and EIP addresses from running processes¶
Return threads count of a process¶
Figure out what shell you're running¶
Kill all processes belonging to a user¶
List all PostgreSQL databases. Useful when doing backups¶
Show the command line for a PID with ps¶
Check ps output to see if file is running, if not start it¶
easily strace all your apache child processes¶
easily strace all your apache processes¶
count how many cat processes are running¶
Chrome sucks¶
ps -e -m -o user,pid,args,%mem,rss | grep Chrome | perl -ne 'print "$1\n" if / (\d+)$/' | ( x=0;while read line; do (( x += $line )); done; echo $((x/1024)) );
Sort output by column¶
lazy SQL QUERYING¶
List PHP-FPM pools by total CPU usage¶
ps axo pcpu,args | awk '/[p]hp.*pool/ { sums[$4] += $1 } END { for (pool in sums) { print sums[pool], pool } }' | sort -rn | column -t
Shows users and 'virtual users' on your a unix-type system¶
find duplicate processes¶
Top ten memory hogs¶
"What the hell is running on?!" Easily snoop your system's RAM consumption¶
Top 10 Memory Consuming Processes¶
get some information about the parent process from a given process¶
Chrome sucks¶
Count threads of a jvm process¶
the executable that started the currently running oracle databases and the ORACLE_HOME relative to each¶
ps -ef |grep oracle |grep pmon |awk '{print $2}' |xargs -I {} ps eww {} |grep pmon |grep -v grep |awk '{print $5 " " $6 " " $0}' |sed 's/\(S*\) \(S*\) .*ORACLE_HOME/\1 \2/g' |cut -f1,2,3 -d" "
print a cpu of a process¶
Search for an active process without catching the search-process¶
Nicely display mem usage with ps¶
See OpenVZ Container id's of top 10 running processes by %cpu¶
Find processes stuck in dreaded "D" state aka IO Wait¶
List process in unkillable state D (iowait)¶
cpu and memory usage top 10 under Linux¶
ps -eo user,pcpu,pmem | tail -n +2 | awk '{num[$1]++; cpu[$1] += $2; mem[$1] += $3} END{printf("NPROC\tUSER\tCPU\tMEM\n"); for (user in cpu) printf("%d\t%s\t%.2f%\t%.2f%\n",num[user], user, cpu[user], mem[user]) }'
View Processeses like a fu, fu¶
kill all running instances of wine and programs runned by it (exe)¶
Given process ID print its environment variables¶
'micro' ps aux (by mem/cpu)¶
Find the process you are looking for minus the grepped one¶
Search for a process by name¶
kill all foo process¶
Given $PID, print all child processes on stdout¶
Remove grep itself from ps¶
Display top 5 processes consuming CPU¶
Show CPU usage for EACH cores¶
grep processes list avoiding the grep itself¶
Transfer a file to multiple hosts over ssh¶
easily strace all your apache processes¶
Top ten (or whatever) memory utilizing processes (with children aggregate) - Can be done without the multi-dimensional array¶
ps axo rss,comm,pid | awk '{ proc_list[$2] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' | sort -n | tail -n 10
memory usage¶
Sort all running processes by their memory & CPU usage¶
Kill all processes belonging to a user¶
Discover the process start time¶
List users with running processes¶
psgrepp¶
count how many cat processes are running¶
find out zombie process¶
ps grep with header¶
List Threads by Pid along with Thread Start Time¶
Run a script in parrallel over ssh¶
Chrome sucks¶
Chrome sucks¶
Find a process by name and automatically kill it¶
Get the name or user running the process of specified PID¶
count and number lines of output, useful for counting number of matches¶
Show WebSphere AppServer uid|pid|cell|node|jvms¶
ps -ef | grep [j]ava | awk -F ' ' ' { print $1," ",$2,"\t",$(NF-2),"\t",$(NF-1),"\t",$NF } ' | sort -k4
Display the specified range of process information¶
all users with terminal sessions¶
kill all process that belongs to you¶
NOTHING TO KILL"; fi; cat .tmpkill; rm .tmpkill;¶
ps -u $USER -lf | grep -vE "\-bash|sshd|ps|grep|PPID" > .tmpkill; if (( $(cat .tmpkill | wc -l) > 0 )); then echo "
psgrep(command)¶
Sum using awk¶
Display the top ten running processes - sorted by memory usage¶
Get a PostgreSQL servers version¶
get process id with program name¶
Display all zombie process IDs¶
Get a PostgreSQL servers version¶
printing with psnup¶
Using psnup to get two pages per page¶
Kill all Zombie processes one-liner¶
Display the top ten running processes - sorted by memory usage¶
total percentage of memory use for all processes with a given name¶
Grep without having it show its own process in the results¶
processes per user counter¶
'micro' ps aux (by mem/cpu)¶
Count total processes for specific program and user¶
Display the top ten running processes sorted by the memory usage:¶
Get the number of open sockets for a process¶
To get the average httpd process size, log into your server and run the following on the command line¶
If you want to calculate the average on-the-fly¶
ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'
find the full amount of ram associated with mysql¶
Find the processes that are on the runqueue. Processes with a status of¶
Total procs, avg size (RSS) and Total mem use¶
ps awwwux | grep httpd | grep -v grep | awk '{mem = $6; tot = $6 + tot; total++} END{printf("Total procs: %d\nAvg Size: %d KB\nTotal Mem Used: %f GB\n", total, mem / total, tot / 1024 / 1024)}'
Display the top ten running processes - sorted by memory usage¶
Given $PID, print all child processes on stdout¶
Find longest running non-root processes on a machine¶
ps -eo etime,pid,pcpu,ppid,args | sed -e '/\[.\+\]/d' -e '/^[ \t]*[0-9]\{2\}:[0-9]\{2\} /d' | sort -k1r