We have some servers to manage. There are some user access to our server. We want to them log off or kill their processes by terminating. How can be achieve this?
List Logged On Users
We can logout other users forcibly like below. Keep in mind we need to be root to complete this command. First we will list currently logged in users with the
who command. We can use
w command alternatively to list users.
Logout From GUI or Desktop Environment
Different desktop environments provides GUI menus in order to logout from current session. In this example we will logout the user
ismail from and XFCE desktop environment session. From right corner by clicking the user name we will list some menu which provides actions like
Lock Screen ,
Log Out . We can use
Log Out button in order to logout from current user session.
We can logout from current Linux user from terminal with the
Logout Current User
We will use
pkill command. This command will kill all processes owned by the given user with the
-u option. In this example we know that the user
ismail is logged in. We will log out the user
ismail . We will also provide the
-KILL option which will kill all processes related with the user
ismail . Keep in mind that this will suddenly stop all this user related processes. This
$ pkill -KILL -u test2
- User -u test2 is logout
- pkill is the command which will send signals to the provided user processes
- -KILL is the kill signal to the specified user processes.