I wanted to confirm some details with the killall -o option. I tested it on some ssh connections I created under the user rick. First I printed a list of all of ricks ssh connections along with the etime. ps -u rick -o user,pid,etime --sort=etime

Next, I ran the following: killall -i -o 9h ssh-agent. I went and checked each PID against my killall interactive list. The -o option appears to use the elapsed time. However, I want to be able to ensure my killall statement only includes ssh-agents from rick.

I tried killall -i -u rick -o 9h but it kills all rick ssh-agents regardless of the etime.

migrated from stackoverflow.com Mar 21 at 7:00

This question came from our site for professional and enthusiast programmers.

  • If you're on OSX, you might want to check your local man page (man killall) to see if the -o option is supported. The man page I found here does not list that option. I'm guessing on the OSX part because I saw another question on your profile that's about using find on OSX :-). – Haxiel Mar 21 at 9:36
  • I'm on Linux. Here is the link of the mange page I am using man7.org/linux/man-pages/man1/killall.1.html – DizzyNYC Mar 21 at 14:49
  • Ah, okay. While the man page at the given link looks okay, you should still prefer your local man page whenever possible. The local man page usually comes from the same package as the binaries, so it should be the most accurate representation of what your local copy of killall can do. – Haxiel Mar 21 at 15:41
  • Totally understand. It seems that I just need to get the options in the correct order maybe? I know killall -i -o 9h ssh-agent works and uses the elapsed time but how would I go about changing this to check for a user instead? – DizzyNYC Mar 21 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.