How Do I Logout a User in Unix?
Contents

Logging out of UNIX may be achieved simply by typing logout, or or exit. All three terminate the login shell and , in the former case, the shell performs commands from the . bash_logout file in your home directory.

How do I logout a user in Linux?

Steps to kick out user in Linux:

  1. Launch terminal.
  2. List currently logged in user in the system. …
  3. List all processes owned by the user you want to kick out of the system. …
  4. Kill user’s terminal or other session processes. …
  5. Alternatively, kill all processes owned by the user. …
  6. Check if user still logged in.

How do I logout a user in terminal?

Here the how to:

  1. Edit your .bash_profile. nano ~/.bash_profile.
  2. Add this line: logout() {sudo launchctl bootout user/$(id -u “$1”)}
  3. Save the file pressing ctrl+x.
  4. Restart the terminal.
Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest