How do I log out of Ubuntu?

Suppose you have multiple users in your Ubuntu system, and another user wants to log in to the system using their account. In that case, the user can switch the current account to another or log out of the current user session for another user. The main difference between the two options is that when switching accounts, the current session runs in the background. The user can continue applications in that state when they log back in while logging out of the current session terminates all applications. You can choose the method that works best for you.

There are the following ways to log off the current user session:

Log out using the graphical interface

Click on the downward arrow sign from the top right corner of your desktop on the

Ubuntu Desktop

Ubuntu system. On click, you will see the following dropdown menu will display:

Select Power off /Log out from the dropdown. Now, you will select Log out from all displayed options as follows:

Log out

Click on the Logout option. A dialog will appear on the system where you can cancel the dialog or log out from the current user session. Click on the Log out button to end the current session as follows:

Log out button

If you do not choose any option from both, then your system will be closed automatically after 60 seconds.

Logout through a keyboard shortcut

There are several keyboard shortcuts available in Ubuntu to perform a task. You can log out of the current session using the keyboard. For that purpose, Click on the settings, located on the left corner of your desktop in the dropdown options as follows:

Ubuntu settings

Now, you will select ‘Keyboards Shortcuts’ from the sidebar options of the displayed window. Type ‘log out’ in the search bar. You will see the keyboards shortcut for logging out in the search result as follows:

Logout shortcut

Using the keyboard shortcut Ctrl + Alt + Delete, you can log out of the working session.

Logout using the application search bar

You can log out of the Ubuntu system through the application search bar. That is a quick and fast method, above all. Click on Activities and type ‘Log out’ in the search bar. You will see the logout icon in the search results as follows:

Logout

Click on the displayed Log out icon and Log out of your Ubuntu  system using the dialog option as follows:

Logout user

Log out using the Terminal

Another way that is used for logging out of the Ubuntu system is the command-line method.

Open the terminal application through the keyboard shortcut Ctrl + Alt + t or click on Activities and open it from the application search bar.

Now, type the following command to close the current session or log out from the system:

$ gnome-session-quit

Ubuntu Log out using commandline

When you run the above command, the dialog will display on the system, asking you whether you want to logout out of the session. Click on the logout button to end the running session or if you want to continue this session, click on cancel to close the dialog.

If you want to logout the session directly without displaying any dialog, then you will use the command as follows:

$ gnome-session-quit --no-prompt

After executing the above command, your system will automatically log out of the Ubuntu system without displaying any dialog.

In this article, you have learned four different methods to log out of the current session on the Ubuntu system. So, you can switch from one user account to another user login through the logout or switch user option. I hope you enjoyed this article.