0

I accumulate a lot of "ssh-agent -s" throughout my day due to ssh'ing to various servers. Here is my output from ps aux:

output

Is there a command I can write to kill all the processes with the command "ssh-agent -s"?

MarksCode
  • 8,074
  • 15
  • 64
  • 133
  • 1
    `killall` perhaps? – tadman May 15 '18 at 21:05
  • `killall "ssh-agent -s" No matching processes belonging to you were found` – MarksCode May 15 '18 at 21:06
  • 1
    `man killall` before you go on a murder spree. You can only match the `ssh-agent` part. – tadman May 15 '18 at 21:07
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww May 15 '18 at 22:54

1 Answers1

2

Try this

ps aux | grep 'ssh-agent -s' | awk '{print $2'} | xargs kill -9
Mateusz Wojtczak
  • 1,621
  • 1
  • 12
  • 28
  • 1
    Slight error with the command. I think it should be ```ps aux | grep 'ssh-agent -s' | awk '{print $2}' | xargs kill -9```. There's a problem with the ' being before the } – kgebreki Sep 30 '22 at 19:31