When you are using a Ubuntu system that has multiple users and one of the other user’s requests you to use the system, you have two ways to hand over the system to them. One is to switch users and the other one is to log out of your user session for the other person. The difference between the two is that when you switch users, your current session will keep running in the background and you will be able to get your applications back in the same state when you log in back. However, when you log out, your current session ends and all the running applications will stop. So when you log in back, you will have to re-open all the required applications. You can choose between switching users or logging out, depending on what suits you in that point in time.

In this article, we will describe four ways using which a user can log out of his/her Ubuntu session:

  • Using the UI
  • Using the Keyboard shortcut
  • Through the application launcher search bar
  • Through the Ubuntu command line, the Terminal

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Method 1: Log Out Using the UI

One of the simple ways to log out of your Ubuntu session is to use the menu accessible through the downward arrow located at the top right corner of your Ubuntu screen. This is the menu you will see when you click this arrow:

Ubuntu log out using desktop menu

Click your username and you will be able to see the following two main sub-menu items: Log Out and Account Settings. Click on the Log Out option in order to log out of your current Ubuntu session. The following dialog will display if you do so:

Confirm that you want to log out

This dialog lets you log out right then by clicking the Log Out button. Otherwise, the system automatically ends your session after 60 seconds unless you press the Cancel button.

Method 2: Log Out Using Keyboard Shortcut

Ubuntu comes with a number of default keyboard shortcuts that let you perform frequently used Ubuntu operations by using key combinations from your keyboard. Log out, being a very frequent operation is also assigned such a shortcut. When you hit the Ctrl+Alt+Delete key combination, you are presented with the same Logout dialog that we described above.

You can see all such keyboard shortcuts and even create your own from your system Settings utility. Open the Settings utility directly in the Keyboard view by entering the word “shortcuts” in your application launcher search bar as follows:

Ubuntu Keyboard Shortcuts

Click on the Keyboard search result and you will be able to see the following view:

Log out Keyboard Shortcut

Method 3: Log Out Using the Application Launcher Search

Another quick method to logout of your session is to use the very useful application launcher search bar. This bar can be accessed by hitting 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:

Log Out desktop launcher

Click on the Log Out search result and you will be presented the same Log Out dialog that we described above.

Method 4: Log Out Using 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, the Terminal, either through the application launcher search or the Ctrl+Alt+T shortcut.

Then enter the following command in order to end the current user’s login session:

$ gnome-session-quit

Desktop logout using shell

When you run this command, a dialog appears that lets you log out right then by clicking the Log Out button. Otherwise, the system automatically ends your session after 60 seconds unless you press the Cancel button on this dialog.

If you want to directly log out without having to see this dialog, you can make use of the following command:

$ gnome-session-quit --no-prompt

So, these were some ways you can use to safely log out of your Ubuntu user session so that another user can use the system after you.

4 Ways to Log Out of a Ubuntu Desktop Session