Sometimes I need to end a process quickly via terminal but it is tedious to just type ps -e | grep firefox
and then kill all the time. I want to create an alias
in my .bashrc and just type in killfirefox
I guess this would do it but I don't really understand everything.
so I've learn that either ps -e | grep firefox | sudo awk '{print $1}'
or pgrep firefox
will return the pid of firefox which I need to kill a process. I thought this would do the job :
pgrep firefox | sudo awk '{kill $1}'
but it doesn't work. It says nothing and firefox is still running. I then tried pgrep firefox | sudo awk '{system(sudo kill $1)}'
but then it returns "sh: 1: 27762: not found".
Why doesn't my way work? What's wrong?
sudo
to kill a process you own?). BTW, if you havepgrep
, you also havepkill
.killall firefox
orkillall -r firefox
.