How do you log out of Ubuntu?
The answer depends on whether you are using Ubuntu server or desktop. I’ll show you steps for both.
Logout Ubuntu from terminal (for server)
If you are using Ubuntu server and you are confined to the terminal screen, you can use the exit command:
exit
Yes. That’s the way to logout from terminal because there is no logout command in Ubuntu or any Linux distribution. You have commands for shutdown Ubuntu but there is no separate log out command.
Why there is no logout command in Linux?
You may wonder if there is command for shutdown, command for restart then why there is no Linux command for logout?
The answer lies in the way Linux works. You probably know that Linux is only kernel and you need a shell to interact with the kernel. When you use a terminal or if you log in to an Ubuntu system via SSH, you open a shell session.
If you want to logout from your session, you simply exit the shell. This is why the exit command is equivalent to log out command in Linux.
Log out from Ubuntu desktop (GUI method)
If you are using Ubuntu desktop, you have a graphical interface (called desktop environment). You can use your mouse here.
I am showing the screenshot for the default GNOME desktop but if you are using some other Ubuntu desktop variants like Kubuntu, Lubuntu etc, there should also be a logout button or logout option in the power menu.
To log out from Ubuntu desktop session, go to the top right corner and click to bring the system tray. You should see Power Off / Log Out option. Click on it and it will show the Log Out option.
When you click on the Log Out button, it will open a dialogue box and ask for your conformation. If it receives no input from you, you’ll be logged out in 60 seconds.
That’s it. Now that you know how to log off from Ubuntu session let me tell you a secret tip.
You can use Ctrl+Alt+Del keyboard shortcut in Ubuntu to bring the logout menu. Cool, isn’t it?