Logging out in linux

How to Log Out from Ubuntu Session [Beginner’s Tip]

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:

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.

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.

Log Out Ubuntu

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.

Log Out Confirmation Ubuntu

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?

Источник

How to log out from Ubuntu terminal

If you have a multi-user Ubuntu system, and some other users ask to use it then you have two options for granting him access to the system: The first option is to switch users, and in the second option, you can log out of your user session, thinking about which option will be best for you to avail? Let me explain the differences in functionality between these two options. If you go for the first option of switching users, your current session continues to operate in the system background, and when you log back in, you can restore the programs to their previous state. However, if you select the second option of logging out from the user session, your current session will end with all running applications. As a result, you have to re-open all of your applications once again when you log back in.

Читайте также:  Linux deploy require superuser

Selection between logging off and switching users option depends upon your requirements. But if you want to hand over the control of your Ubuntu system to another user, log out of the current session and permit another user to log in. Logging out disallows the other users to access your system without verifying their credentials. Another security aspect that the log-out option covers is that it protects the access of current users and forbids the authorized actions on the current login session. It also ensures that after the login session, the user’s access and credentials are safe.

In Ubuntu, you can log out from your current session using Ubuntu User Interface (UI), the Application’s search bar, and a Keyboard shortcut. Using the Ubuntu terminal to log out of your system is another straightforward method. This post will demonstrate how to log out from the Ubuntu terminal. So let’s start!

How to log out from Ubuntu terminal

To follow the procedure of logging out using the terminal, firstly, open up your Ubuntu terminal by pressing “CTRL+ALT+T”.You can utilize the “gnome-session-quit” command for terminating your current GNOME session. Here is the syntax of the “gnome-session-quit” command:

The “gnome-session-quit” command provides support to the following option:

  • –logout: This option is used to confirm the log-out by displaying a prompt. That’s how things work by default in the “gnome-session-quit” command.
  • –power-off: This option is used to prompt the user for verifying system reboot.
  • –reboot: This option requests the current user to confirm the system reboot through a prompt.
  • –force: This option is utilized to ignore any inhibitors.
  • –no-prompt: If you add the “–no-prompt” option in the “gnome-session-quit” command, the current session will end without any user interaction.

In our case, we only have to log out from the current session. From your current session, you will be logged out by executing below-given command in the terminal:

As we have not added any options in the “gnome-session-quit”, this command will display a prompt before log out. Log out from the system while prompting the user is the default behavior of this command:

Читайте также:  What is shell program in linux

Here, confirm the log out by clicking the “Log Out” button; otherwise, you will be logged out from your system automatically in 60 seconds:

To log out from your Ubuntu current session, without any user interaction, write out the below-given command in your terminal:

After execution, you will be redirected to the following window:

Select the one you want to switch from the available list of system users and then enter the password. You are all ready to use your system!

Conclusion

To allow any other user to use your Ubuntu system, either you can switch users or log out from the current session. The process of logging out of your system maintains every security related to the current user’s access. In Ubuntu, you can log out from your current session using Ubuntu UI, Keyboard Shortcut, Application’s search bar, and terminal. This article showed you how to log out from the Ubuntu terminal using the “gnome-session-quit” command.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.

Источник

4 Ways to Log Out of a Ubuntu Desktop Session

Ubuntu Desktop Log Out

Ubuntu Desktop Logout

If you are using an Ubuntu system with multiple users and one of the other users asks you to use the system, you have two options for giving the system to him. One is to switch users, and the other 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 continues to run in the background and you can restore your applications to the same state when you log back in. However, when you log off, your current session is terminated and all running applications are stopped. So when you log back in, you will have to reopen all the applications you need. You can choose between switching users and logging off, whichever suits you at the 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 20.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:

Читайте также:  Аналог терминала linux для windows

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 set of default keyboard shortcuts that allow you to perform commonly used Ubuntu operations with keyboard shortcuts. Logging out, a very common operation is also assigned such a keyboard shortcut. When you press the key combination Ctrl+Alt+Del, the same logout dialog we described above is displayed.

You can see 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 typing the word “keyboard shortcuts” into the search bar of your application launcher 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 log out 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 with 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:

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.

About This Site

Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.

Latest Tutorials

Источник

Оцените статью
Adblock
detector