5 ms·
I do not like the grep -v grep pattern. I think the regexp trick should be prefered: :!ps axuw | grep [v]im | awk '{print $2}' | xargs kill -9 This can al
by reacweb 7y ago
I do not like the grep -v grep pattern. I think the regexp trick should be prefered:
:!ps axuw | grep [v]im | awk '{print $2}' | xargs kill -9
This can also be merged in the awk command:
:!ps axuw | awk '/[v]im/{print $2}' | xargs kill -9
- wadkar 7y agoUgh, ps|grep is unnecessary. Just use pgrep! Or even better, pkill -9 ;-)
- xorcist 7y agopgrep is a good habit, it's on every major unix except perhaps aix. Most other constructions can backfire in some unexpected way.
- JdeBP 7y agoNext you'll be telling people to use SIGHUP instead of SIGKILL. Or to use the PID. Or to get VIM to substitute its own PID into the ex command using getpid(). * https://mywiki.wooledge.org/ProcessManagement#The_risk_of_parsing_the_process_tree https://mywiki.wooledge.org/ProcessManagement#The_risk_of_pa...
- JdeBP 7y agoIssue 26 (q.v.) is closed.
- cptnapalm 7y agoI started using Linux in 1997 and just today I've found out about pgrep and, on reddit, sudo !! What a day!
- wadkar 7y agoWow! Glad to be part of your journey in discovering linux. I have been amazed by linux since my teenager years and it still has so much more to offer. May we be blessed to be amazed for the eternities of our mortal lives.
- cptnapalm 7y agoThe UNIX ecosystem (digisystem?) always has more to find. Also, your reply is the kindest comment I've ever seen on HN.