
Terminal - Commands using ps - 244 results
This is sample output - yours may be different.
This is sample output - yours may be different.
Llist all the processes in the run queue.
output=$(ps -ef|grep -i java 2>/dev/null); for w in ${output[@]}; do if [[ $w =~ .*Xmx.* ]]; then result=$(grep -oP "[0-9]+" <<< $w); echo $result ;fi ; done| awk 'BEGIN {sum=0} {for(i=1; i<=NF; i++) sum+=$i } END {print sum}'
This is sample output - yours may be different.
This will find all the -Xmx[BIGINT] running on a system, add them up for you and give you the total.
svn ps svn:executable yes /web/itscripts/check_mail.plproperty
This is sample output - yours may be different.
'svn:executable' set on '/web/itscripts/check_mail.pl'
Sets the exec bit on a file.
This is sample output - yours may be different.
[[email protected] ~]$ ps -u jl -LF
UID PID PPID LWP C NLWP SZ RSS PSR STIME TTY TIME CMD
jl 2725 2722 2725 0 1 24466 1824 0 23:02 ? 00:00:00 sshd: [email protected]/0
jl 2726 2725 2726 0 1 27084 1844 1 23:02 pts/0 00:00:00 -bash
jl 2848 2844 2848 0 1 24466 1844 1 23:10 ? 00:00:00 sshd: [email protected]/1
jl 2849 2848 2849 0 1 27110 1892 1 23:10 pts/1 00:00:00 -bash
jl 2917 2726 2917 0 1 25281 992 0 23:17 pts/0 00:00:00 man sort
jl 2920 2917 2920 0 1 26523 1152 0 23:17 pts/0 00:00:00 sh -c (cd "/usr/share/man" && (echo ".ll
jl 2921 2920 2921 0 1 26523 564 0 23:17 pts/0 00:00:00 sh -c (cd "/usr/share/man" && (echo ".ll
jl 2925 2921 2925 0 1 26361 868 1 23:17 pts/0 00:00:00 /usr/bin/less -is
jl 3185 2849 3185 0 1 27559 1144 0 23:47 pts/1 00:00:00 ps -u jl -LF
Piping ps into grep is mostly useless: ps has its own filter options like -u and -C
This is sample output - yours may be different.
$ psgrep syslogd
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 23 0.0 0.0 2457208 676 ?? Ss Mon09AM 0:02.63 /usr/sbin/syslogd
Pipes the header row of ps to STDERR, then greps for the command on the output of ps, removing the grep entry before that.
This is sample output - yours may be different.
user 20905 21706 20905 0 6 111980 226256 4 10:10 ? 00:00:00 (wsgi:userprocess) -k start -DSSL
This shows all process (-e) and threads (-L) in full format (-F)
ps aux | grep $(echo $1 | sed "s/^\(.\)/[\1]/g")
This is sample output - yours may be different.
This is sample output - yours may be different.
[[email protected] ~]# ps -ef | grep [2]8144
root 28144 1 0 Jun16 ? 00:00:00 /opt/omni/lbin/bsm -session_key 25 -owner root root server 28142 4294967295 -lang C -read SmOptions_28142_server_615
[[email protected] ~]# ps -eo pid,lstart,cmd | grep [2]8144
28144 Sun Jun 16 23:00:01 2013 /opt/omni/lbin/bsm -session_key 25 -owner root root server 28142 4294967295 -lang C -read SmOptions_28142_server_615
That is useful to discover the start time of process older than 1 day.
You can also run:
ls -ld /proc/PID
That's returning the creation date of the proc files from the process. Some users reported that this way might show you a wrong date since any other process like cron, for example, could change this date.
sudo lsof -p `sudo ps aux | grep -i neo4j | grep -v grep | awk '{ print $2 }'`
This is sample output - yours may be different.
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 0 -> /dev/null
l-wx------ 1 neo4j nogroup 64 Jun 2 09:30 1 -> /var/log/neo4j/console.log
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 10 -> /usr/share/neo4j/lib/neo4j-jmx-1.9.jar
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 100 -> socket:[29257]
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 102 -> /var/lib/neo4j/data/graph.db/index/lucene/node/nameSearch/write.lock
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 104 -> /var/lib/neo4j/data/graph.db/index/lucene/node/Actor/write.lock
lrwx------ 1 neo4j nogroup 64 Jun 2 09:57 105 -> /var/lib/neo4j/data/graph.db/index/lucene/node/Actor/_c.fdt
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 106 -> /var/lib/neo4j/data/graph.db/index/lucene-store.db
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 107 -> /var/lib/neo4j/data/graph.db/index/lucene.log.1
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 108 -> /usr/lib/jvm/java-6-sun-1.6.0.45/jre/lib/jsse.jar
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 109 -> /usr/lib/jvm/java-6-sun-1.6.0.45/jre/lib/ext/sunjce_provider.jar
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 11 -> /usr/share/neo4j/lib/neo4j-kernel-1.9.jar
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 110 -> /var/lib/neo4j/data/rrd
l-wx------ 1 neo4j nogroup 64 Jun 2 09:30 111 -> /var/log/neo4j/http.log
lr-x------ 1 neo4j nogroup 64 Jun 2 09:30 112 -> pipe:[29804]
l-wx------ 1 neo4j nogroup 64 Jun 2 09:30 113 -> pipe:[29804]
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 114 -> anon_inode:[eventpoll]
lrwx------ 1 neo4j nogroup 64 Jun 2 09:30 115 -> socket:[29805]
Inner "ps...grep..." command searches for a process matching the specified .
"lsof -p lists all file descriptors owned by . Includes open files, sockets, devices, etc...
ps aux | sort -n -k2 | awk '{if ($2 < 300) print($0)}'
This is sample output - yours may be different.
Display all pid less the 300 processes info
ps aux | awk '/chrome/ {s+=$6}END{print s/1024}';
This is sample output - yours may be different.
ps -A -o rss,command | grep [C]hrome | awk '{sum+=$1} END {printf("%sMB\n",sum/1024)}'
This is sample output - yours may be different.
ps -o rss= -C Chrome | (x=0; while read rss; do ((x+=$rss)); done; echo $((x/1024)))
This is sample output - yours may be different.
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)) );
This is sample output - yours may be different.
How much memory is chrome sucking?
renice -20 -g 2874 (2784 found with ps -Aj)
This is sample output - yours may be different.
ps aux | grep [process] | awk '{print $2}' | xargs -I % ls /proc/%/fd | wc -l
This is sample output - yours may be different.
ps aux | grep <process> | grep -v grep | awk '{print $2}' | xargs -i -t kill -9 {}
This is sample output - yours may be different.
ps auxw | grep sbin/apache | awk '{print"-p " $2}' | xargs strace -f
This is sample output - yours may be different.
This version also attaches to new processes forked by the parent apache process. That way you can trace all current and *future* apache processes.
ps -u user_name_here | grep process_name_here | wc -l
This is sample output - yours may be different.
ps -xaw -o state,ppid | grep Z | grep -v PID | awk '{ print $2 }' | xargs kill -9
This is sample output - yours may be different.
Did some research and found the previous command wrong, we don't kill a zombie but its parent. Just made some modifcation to khashmeshab's command.
This is sample output - yours may be different.
[email protected]:~$ ps axu | grep [a]pache2
root 9399 0.0 0.1 105628 7588 ? SNs 11:55 0:01 /usr/sbin/apache2 -k start
www-data 9401 0.0 0.1 105716 5576 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9402 0.0 0.1 105716 5572 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9403 0.0 0.1 105668 5028 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9404 0.0 0.1 105716 5576 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9405 0.0 0.1 105652 4788 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 15581 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
www-data 15582 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
www-data 15583 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
Trick to avoid the form:
grep process | grep - v grep
while true; do date; ps auxf | awk '{if($8=="D") print $0;}'; sleep 1; done
This is sample output - yours may be different.
ps -ef | awk -v OFS="\n" '{ for (i=8;i<=NF;i++) line = (line ? line FS : "") $i; print NR ":", $1, $2, $7, line, ""; line = "" }'
This is sample output - yours may be different.
1:
root
3410
00:00:00
gpm -m /dev/input/mice -t exps2
2:
root
3424
00:00:00
crond
3:
root
3488
00:00:00
/usr/sbin/atd
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")}'
This is sample output - yours may be different.
1.49 GB 6457 1001 /opt/google/chrome/chrome --type=renderer --lang=en-US --force-fieldtest=CacheListSize/CacheListSize_14/ConnCountImpact/conn_count_6/ConnnectBackupJobs/ConnectBackupJobsEnabled/DnsImpact/default_enabled_prefetch/DnsParallelism/parallel_default/GlobalSdch/global_enable_sdch/IdleSktToImpact/idle_timeout_10/Instant/HiddenExperimentB/Prefetch/ContentPrefetchPrerender2/PrerenderFromOmnibox/OmniboxPrerenderEnabled/PrerenderFromOmniboxHeuristic/ExactFullAlgorithm/ProxyConnectionImpact/proxy_connections_32/SpdyCwnd/cwnd10/SpdyImpact/npn_with_spdy/WarmSocketImpact/warmest_socket/ --extension-process --enable-print-preview --channel=6390.0xb9b71c60.593461523
630.18 MB 2488 1001 /usr/lib/thunderbird-3.1.8/thunderbird-bin
501.08 MB 3426 1001 /usr/lib/firefox-3.6.3/firefox-bin
272.55 MB 11897 1001 /usr/lib/chromium-browser/chromium-browser
Finding high memory usage report in human readable format.