I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
For your process finding one, you might want to exclude the grep command itself, depending on what system you're on. On a Mac, for example, you'll get the process used to grep listed, which is generally not what you want. Also on a Mac, ps -aux will fail if there isn't a user called "x" because ps interprets commands differently depending whether you use a dash or not (I know!).
alias pid='ps aux | grep -v grep | grep'
Or if you're only interested in the PID (as implied by the alias name, you can use pgrep which fits nicely with pkill because without any other options it just returns the PID.
I know you tagged this with #linux but I think it's good to make things as general as possible so if you have to work on a BSD system or a Mac you can re-use the same commands.
👋 Hey there, I am Waylon Walker
I am a Husband, Father of two beautiful children, Senior Python Developer currently working in the Data Engineering platform space. I am a continuous learner, and sha
For your process finding one, you might want to exclude the grep command itself, depending on what system you're on. On a Mac, for example, you'll get the process used to grep listed, which is generally not what you want. Also on a Mac,
ps -aux
will fail if there isn't a user called "x" becauseps
interprets commands differently depending whether you use a dash or not (I know!).Or if you're only interested in the PID (as implied by the alias name, you can use
pgrep
which fits nicely withpkill
because without any other options it just returns the PID.I know you tagged this with #linux but I think it's good to make things as general as possible so if you have to work on a BSD system or a Mac you can re-use the same commands.
I need to use
pgrep
more I still hand type the alias that you showed.