edit: `ps aux|grep`, indeed. Silly me in the early hours of a rest day :).
I've made a note to name the executable for my next daemon "humans".
See also the 'reboot' (or is it the 'poweroff' ?) command, which is much more direct than the Linux equivalent...
ps -ef | grep $1 | awk '{print "kill -9 " $2}' | sh
Usually stored as /usr/local/bin/kllI've found it's very useful for killing specific Java programs without having to killall -9 java.
(and, yeah, I should probably be using ps -efww instead of ps -ef, but old habits die hard... I've already got ps aliased to ps -ww for interactive use, so I should probably change this script...)
What's wrong with doing that?
I've been doing that for so long I don't know why I do it
ps -C procname
ps -p pid
ps -u username
ps -t ttyname
ps -f [-w [-w]]
ps -o output-format pgk ()
{
[ -z "$*" ] && echo 'Usage: pgk <pattern>' && return 1;
pgrep -fl $*;
[ "$?" == "1" ] && echo 'No processes match' && return 1;
echo 'Hit [Enter] to pkill, [Ctrl+C] to abort';
read && pkill -f $*
}Anyway, it's just a reflex now to always:
ps aux | grep <program> | grep -v grep ps -ef | grep [p][r][o][g][r][a][m]This is why I love HN, I learn stuff I never knew I wanted to know!
Yes, I do sometimes have processes with camel-cased names which I may or may not remember exactly. So you:
ps auwx | grep -i {lc-version-of-camel-cased-name}In regard to ps you can memorize a few commands until something truly weird comes up since you will probably use other more specialized snapshotting and tracing tools for anything somewhat difficult to troubleshoot.
Yup, this is true. And I did. But sometimes you just need less dense manual pages.
- grep bash /proc/*/status
- readlink /proc/*/fd/* | grep /runThat's why I was so happy to stumble across pstree the other day. Even the man page is excellent! Every now and again, I'll come across a util like this that I can put into immediate action w/o lots of deciphering. pstree -a is awesome for a relative newbie like me.