Now, for something completely different: (mid lenght post)
Years, actually decades ago, as i was a very young padawan, discovering and in tiny part shaping (a _VERY_ tiny part of) the early internet (world wide web way back then).
A unix guru gave his shine to me .. and told me a nice lesson, i never forgot, and with the help of the almighty internet relay chat (IRCNet) even was able to improve upon a tiny bit.
Way back then, you mainly had ps
and top
to list and manage your processes on a Unix based system.
Modern fancy stuff like killall
didn't exist for a while, not to name pgrep
even. (We're talking mid to late 90ies here).
So, this unix guru came over to me to tell me a nice trick for my linux boxes at home.. I won't repeat the original one, but will skip directly to the (just slighty) improved one;
It's a bash function called psg (procname)
psg ()
{
/bin/ps xau | /bin/grep COMMAND\\\|$1 | /bin/grep -v grep
}
As you can imagine, psg stands for "ps grep". You can use it with the name of the process, the pid or even a part of its commandline to get exactly only processes listed which match your grep.
You don't need to remember any commandline parameters or anything at all (unlike pgrep) .. but just fire and forget, take what you get. (It's truly KISS-compliant;)
The "original version" i got told skipped the header from the ps
command and just spat out the processes, but i liked to have the header preserved. So at some time i questioned people in #linux.de on IRCNet about how to improve the grep cmd(s) for that reason.
And here we are ... you're welcome to use psg
anytime you want..... and preserve the lore! ;)
#Unix #Unices #Unixes #Linux #Retro #Retrocomputing #NextStep #Bash #Script #Lore #KISS #RandomShit ;)
P.s.: What i was shaping? Ouh shoot..... i was employed to write down early html (1.1) to implement the wet dreams of some few graphics designers from their macintosh with photoshop.... We didn't have frames .. but we had tables!! (yeah i know. ;))