Windows
Linux
System & Storage
System
Windows logoff equivalent in Linux
Ends the current user session, closing all running processes owned by that user.
Windows
→
logoff
Linux equivalents
logout / pkill -KILL -u username
logout / pkill -KILL -u username
logout / pkill -KILL -u username
Overview
What this command does
Ends the current user session, closing all running processes owned by that user.
Migration tip: In a terminal,
logout or exit ends the session. To forcibly log out another user, kill all their processes with pkill -KILL -u username.Practical tasks
Common use cases
Log off the current user session
Ends the current user session, closing all running processes owned by that user.
logout
Log out of login shell
exit
Exit current shell
pkill -KILL -u username
Force log out another user
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
logout
exit
sudo pkill -KILL -u john
sudo loginctl terminate-user john
Walkthrough
Examples with explanations
# Windows: logoff
logout # in a login shell
exit # in any shell
# Force log out user 'john':
sudo pkill -KILL -u john
sudo loginctl terminate-user john
Reference
Common options and variations
| Command or option | Use |
|---|---|
logout | Log out of login shell |
exit | Exit current shell |
pkill -KILL -u username | Force log out another user |
loginctl terminate-user john | Terminate all sessions for a user |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | logout / pkill -KILL -u username |
Same command on this distribution. |
| Fedora | same command | logout / pkill -KILL -u username |
Same command on this distribution. |
| Arch | same command | logout / pkill -KILL -u username |
Same command on this distribution. |
Keep learning