4 ms·
Funny story about -v. I was using pkill to get rid of some hung processes on a remote server. For some reason I decided to get verbose output and run pkill -v.
by shanemhansen 10y ago
Funny story about -v. I was using pkill to get rid of some hung processes on a remote server. For some reason I decided to get verbose output and run pkill -v.
Turns out -v negates the match so I killed every process on the box but one.
I had to email someone to reboot the server.
- deleted 10y ago[deleted]
- justinsaccount 10y agoI've done that exact thing! Took me a few minutes to realize what happened. Luckily it was just a VM. It makes sense in the context of pgrep, since that emulates grep. But kill does not have a -v flag that means inverse.
- lucb1e 10y agoI use grep -v all the time and still think it's a really weird choice for the negate option. (It's called "invert match" in the man page; there's at least a v in there.) Arguably grep predates any common practices, but I'd have to look that up.
- matt_wulfeck 10y agoOh my gosh. I'm so glad I just read that. For the life of me I can't understand why someone would want to say "let me send a kill to every single process on this host but this one..."
- __derek__ 10y agoNo idea, but there it is: -v Reverse the sense of the matching; display processes that do not match the given criteria. I'm similarly happy that I read that before I went off and did something stupid.
- d0mine 10y agoSometimes it is easier to specify the reverse regex using the option instead of trying to invert it manually http://stackoverflow.com/questions/466053/regex-matching-by-exclusion-without-look-ahead-is-it-possible http://stackoverflow.com/questions/466053/regex-matching-by-...