--- title: How to logout a Linux desktop session from command line date: 2026-07-13 11:37:48.063593 UTC --- I often go out then remotely access to my home PC to work. Sometimes I use that PC at home, running a desktop session then forget to logout when leaving home. At a consequence, many programs run and waste the CPU, RAM. How to logout that session when I'm not at home? There is a command to do that, `loginctl`. So, from the coffee shop, I just SSH to my home PC, then run this: ```sh loginctl terminate-user $USER ``` It will logout the desktop session, and also current SSH session. There are other `loginctl` subcommands to logout only a specific session. Just discover yourselves!