'ps' let you specify the format that you want to see on the output. Show Sample Output
'ps ax' provides the fill list of running processes. 'grep -c [c]at' will find all processes that match 'cat' without matching itself.... Show Sample Output
short, sweet, and works after sudoing a new shell. Show Sample Output
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.
Finding high memory usage report in human readable format. Show Sample Output
Will stop all running containers, then remove all containers **This isn't for selectively handling containers, it removes everything**
Show the command line for a PID with ps
Will open strace on all apache process, on systems using sbin/apache (debian) or sbin/httpd (redhat), and will follow threads newly created.
Short list about top 10 processes, sorted by CPU usage Show Sample Output
It displays the top 10 processes sorted by memory usage Show Sample Output
I've wanted this for a long time, finally just sat down and came up with it. This shows you the sorted output of ps in a pretty format perfect for cron or startup scripts. You can sort by changing the k -vsz to k -pmem for example to sort by memory instead.
If you want a function, here's one from my http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
aa_top_ps(){ local T N=${1:-10};T=${2:-vsz}; ps wwo pid,user,group,vsize:8,size:8,sz:6,rss:6,pmem:7,pcpu:7,time:7,wchan,sched=,stat,flags,comm,args k -${T} -A|sed -u "/^ *PID/d;${N}q"; }
Show Sample Output
Shows a list of users that currently running processes are executing as.
YMMV regarding ps and it's many variants. For example, you might need:
ps -axgu | cut -f1 -d' ' | sort -u
Show Sample Output
While going through the source code for the well known ps command, I read about some interesting things.. Namely, that there are a bunch of different fields that ps can try and enumerate for you. These are fields I was not able to find in the man pages, documentation, only in the source. Here is a longer function that goes through each of the formats recognized by the ps on your machine, executes it, and then prompts you whether you would like to add it or not. Adding it simply adds it to an array that is then printed when you ctrl-c or at the end of the function run. This lets you save your favorite ones and then see the command to put in your .bash_profile like mine at : http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html Note that I had to do the exec method below in order to pause with read. t () { local r l a P f=/tmp/ps c='command ps wwo pid:6,user:8,vsize:8,comm:20' IFS=' '; trap 'exec 66 exec 66 $f && command ps L | tr -s ' ' >&$f; while read -u66 l >&/dev/null; do a=${l/% */}; $c,$a k -${a//%/} -A; yn "Add $a" && P[$SECONDS]=$a; done } Show Sample Output
Inspired by #7065
This command will allow to search for duplicate processes and sort them by their run count. Note that if there are same processes run by different users you'll see only one user in the result line, so you'll need to do:
ps aux | grep <process>
to see all users that run this command.
Show Sample Output
(separator = $IFS)
Works on most unixes, on OpenBSD replace the "-g" parameter at the sort with a "-n".
How much memory is chrome sucking? Show Sample Output
It requires https://jqplay.org/, that comes with brew: brew install jq Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: