I’m using putty to connect to Centos and sometimes it disconnect, and the open terminals on centos stays open, is there a way by a command line to close/kill all open terminals?
I’m using putty to connect to Centos and sometimes it disconnect, and the open terminals on centos stays open, is there a way by a command line to close/kill all open terminals?
4
Answers
if you are using linux then just find out the process id of the putty
use
ps -a
to get PID of process then usekill PID
on Windows:
Identify processes
ps -ef | grep -E ‘ssh.*pts’ | grep -v grep |awk -F” ” ‘{print $2}’
The above script it will give you the PID of those ssh pst connections on your machine; then as Vikas said you can kill those processes, remember be aware by using the kill command.
NOTE: you can use the last command where you can see a list of the current/olders session on your machine.
Kill processes
kill -9 PID1 PID2 PID3
Kill old login wit command:
You can use ‘screen’ program for reconnect from where your connection was lost.
If you want to kill all open terminals except for the current one, you can use
pgrep bash
lists the pids of all the active terminalsif the terminals refuse to die, you can use
the “-9” is used to send the SIGKILL Signal to the process