This question already has an answer here:
- How to kill all processes matching a name? 11 answers
I have this alias to kill all neovim instance:
alias killnvim="ps -ef | grep nvim | awk '{print $2}' | xargs kill &> /dev/null"
Each time I run it it always return this message:
[1] 20958 done ps -ef |
20959 done grep --color=auto nvim |
20960 done awk '{print }' |
20961 terminated xargs kill &> /dev/null
What should I do to suppress that message? I want my command to output nothing.
I'm using zsh if that matter.
Thanks.
killall nvim
? – Cyrus Jun 1 '18 at 4:27killall
or even better,pkill
, is the correct solution.ps
and grepping the result is a hack. – Kusalananda Jun 1 '18 at 7:38zsh
doesn't provide a way to do this with its built-inkill
or via a module likezkill
. – chepner Jun 1 '18 at 18:35