So far, I already know there are many ways to end a ssh session and disconnect from remote server. Assume under the environment of bash.
Bash built-in command exit
$ exit
Bash built-in command logout
$ logout
External command fuser
$ fuser -k /dev/pts/[n]
Can anyone explain what's the difference between these commands? Personally Ctrl + D is my favorite one, because it's the fastest one.
In that case, you can type ~. to close the SSH session and return to your local command line terminal. This works as an escape character for SSH connections.
To end the Putty session, type the logout command such as exit or logout. This command might vary between servers. You can close the session by using the Close button.
disown will keep the process running after you log out. The -h flag prevents hangup. screen and others can do it, but that's not what they're for.
CTRL + d
causes a logout
. logout
causes an exit
. exit
on its own is different only because it allows you to specify a non-zero exit code in case it's needed. So the first 3 options are equivalent.
Killing ssh, or the terminal will just break the connection. I'm not sure what you're going for with "gentle", but that is not it.
Assuming that by gentle you meant closing connections without errors on either side, just keep using CTRL + d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With