How do I end/log out of a command line SSH session?

nick asked this question 14 days ago
nick 14 days ago

When I have a SSH session open in my terminal, how can I disconnect from the remote server and return the terminal back to my local machine?

My operating system is Ubuntu 20.04.

4 suggested answers
looper003 13 days ago · Edited

The exit bash command will do the trick for you:


That will close the connection to your remote server and return you to your local machine.

0 replies
itsbambi 13 days ago · Edited

This command will do it:


This is a built-in bash command, much like exit.

0 replies
yaboy01 13 days ago

Ctrl+D keyboard shortuct.

This closes the bash shell by sending an EOF (End-of-file) marker to bash. When bash receives that marker, it will exit the SSH session.

0 replies
suparman21 13 days ago · Edited

Some methods:

  • exit command
  • logout command
  • Ctrl+D keyboard shortcut
0 replies