I often need to check if a process is running, so I use one of these:
ps aux | grep myprocess
ps -Fe | grep myprocess
top
pgrep myprocess (only shows the PID)
pkill myprocess (if I want to kill it)
All of the above commands work well but, is there a shorter command to do this?
Any answer is appreciated, but the chosen one needs to be…
- A built in solution, as I work with many different devices.
- Enables to use a pattern.
- Gives you similar information than ps aux.
- Shorter than what we already know.
Thanks
Best Answer
I think what you're asking for doesn't exist so why not write a little bash function or script that does exactly what you want?
Stick that in your
~/.bash_functions
(or wherever is called by~/.bashrc
) and callsource ~/.bashrc
to reload it and you should be able to run:The expression will take a regex which makes it doubly handy. And
p
on its own will give you a full listing.