When you use a terminal or if you log in to a Linux 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.
Also, When multiple users are using your system, you need to logout from one user account and login back in with another user.
At that time, switching the user option is not a good choice because by doing this current session running in the background.
Therefore, when you logout a user, it will quit the current user's session, and running processing will also close on your system.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform CentOS related Installation tasks.
In this context, we shall look into different methods to logout of the CentOS 8 system.
We can use the following different ways you can log out of the CentOS 8 system:
i. Logout using the command line.
ii. Logout session using the CentOS system menu.
iii. Logout using the Activities application search.
iv. Logout using the keyboard shortcut.
Note that this also applies to other Linux distributions like Ubuntu, Debian, and Linux Mint.
Now we will look into these methods in more details.
Here, you can logout of the current user session using the command line.
i. To implement this, launch terminal from the system 'Activities' located on the top left corner in CentOS 8.
ii. Click on it and then from the sidebar open the terminal application by clicking on the terminal icon.
iii. Now, use the below-given command in order to logout from the current user’s account on the CentOS 8 system:
$ gnome-session-quit
iv. A dialog will show on the desktop where you can Click on the 'Logout' if you want to quit the current user session otherwise, close it to remain logged in with this user account.
i. Here you can click on the arrow sign in order to open the more drop menu options.
The list of options will display in the top right corner.
ii. Click on the current login user name.
iii. Now, click on the logout to close the current user session.
iv. Then, click on the 'Logout' option in order to quit the current session.
To implement this, follow the process given below:
i. Click on the 'Activities' and type the 'Log Out' keyword in the search bar.
As a result, you will see the logout icon under the search bar.
ii. Click on it in order to logout from the CentOS 8 environment.
i. To logout using the keyboard, first, you will search for the shortcut keys.
ii. So, type keyboard shortcuts in the search bar and click on the highlighted displayed 'keyboard' option.
iii. Scroll your mouse pointer and you will see the logout shortcut keys in the list.
iv. Click on the 'Ctrl+Alt+Delete' in order to logout from the current user's account.
Also you can also change the keyboard shortcut by clicking on the displayed option to set Shortcut.
Here, Press the 'Esc' key to cancel the dialog and if you want to set this shortcut then, press the 'Backspace' key.
This article will guide you on different methods to log out of the #CentOS 8 #Linux system. Therefore, If you want to close the current user session then, Logging out of the system is the best choice.
The main difference between these tools is that kill terminates processes based on Process ID number (PID), while the killall and pkill commands terminate running processes based on their names and other attributes.
To exit CentOS 7:
i. Simply use 'Ctrl-C' to kill terminal commands in linux.
ii. Ctrl-D should be used to terminate nl correctly.
iii. Ctrl-C is just a general way to kill #applications.