If you are using a multi-user Ubuntu system and one of the other users asks you to use the system, you have two options for letting them run the system. One is to switch users and the other is to sign out of your user session for the other person. The difference between the two is that when you switch users, your current session continues to run in the background and you can restore your applications to the same state when you log on again. However, if you log out, your current session will end and all running applications will stop. So when you log back in, you will have to reopen all the applications you need. You can choose between switching users and logging out, depending on what suits you.
In this article we describe four ways a user can log out of their Ubuntu session:
- Using the user interface
- Use the keyboard shortcut
- Via the search bar of the application launcher
- From the Ubuntu command line, the terminal
We have the commands and procedures mentioned in this article on a. executed Ubuntu 04/20 LTS system.
Method 1: sign out using the user interface
One of the easy ways to log out of your Ubuntu session is to use the menu accessible from the down arrow in the top right corner of your Ubuntu screen. This is the menu you see when you click this arrow:
Click on your username and you can see the following two main sub-menu items: Sign out and Account Settings. Click the Log Out option to log out of your current Ubuntu session. The following dialog will appear when you do this:
In this dialog you can log out directly by clicking the Log out button. Otherwise, the system will automatically terminate your session after 60 seconds unless you press the Cancel button.
Method 2: Sign out with keyboard shortcut
Ubuntu comes with a number of standard keyboard shortcuts that you can use to perform common Ubuntu operations with keyboard shortcuts. Such a shortcut is also assigned when logging out, a very common operation. If you press the key combination Ctrl + Alt + Del, the same logout dialog as described above is displayed.
You can view all of these keyboard shortcuts and even create your own using the System Preferences utility. Open the Preferences utility directly from the keyboard view by entering the word “keyboard shortcuts” in the search bar of your application launcher as follows:
Click on the search result keyboard and you can see the following view:advertising
Method 3: sign out using Application Launcher search
Another quick way to log out of your session is to use the application launcher’s very useful search bar. This bar can be accessed by pressing the Super / Windows key on your keyboard.
Enter the keyword “Logout” in this search bar and you will see the Log Out utility in the search result as follows:
Click on the search result Unsubscribe and you will be shown the same unsubscribe dialog that we described above.
Method 4: log out from the terminal
For a terminal savvy person, the Ubuntu command line also provides a way to log out of your Ubuntu user session.
Open the Ubuntu command line, Terminal, either by searching in the application launcher or by using the keyboard shortcut Ctrl + Alt + T.
Then enter the following command to end the current user’s login session:
When you run this command, a dialog box will appear where you can log out directly by clicking the Log Out button. Otherwise, the system will automatically terminate your session after 60 seconds unless you click the Cancel button on this dialog box.
If you want to log out directly without seeing this dialog, you can use the following command:
$ gnome-session-quit --no-prompt
So these were some ways you can safely log out of your Ubuntu user session so that another user can use the system after you.