Adds ps-less way

This commit is contained in:
Tom Hudson 2019-09-25 16:50:21 +01:00 committed by GitHub
parent bfc2c9f3a1
commit d3a6521a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,3 +7,10 @@ Credit: @tomnomnom
``` ```
:!ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -n :!ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -n
``` ```
## The ps-less way
Credit: @tomnomnom
```
:!kill -9 $(find /proc -name "cmdline" 2>/dev/null | while read procfile; do if grep -Pa '^vim\x00' "$procfile" &>/dev/null; then echo $procfile; fi; done | awk -F'/' '{print $3}' | sort -u)
```