Linux logout user or logoff user commands

Q. How do I logout Linux user?

A. root or admin user can logout any user forcefully. If you are logged in as vivek and just wanted to logout or logoff, type logout command or hit CTRL+D:
$ logout

You will be logout of a login shell session or secure shell session.

Task: Linux logout user

If you would like to logout other users, you must login as root user. Next you need to use pkill command.

pkill command syntax

pkill -KILL -u {username}

To see list of logged in user type who or w command:
# who
OR
# w
To logout user called raj, enter:
# pkill -KILL -u raj
OR
$ sudo pkill -KILL -u raj

For more information read our article - Howto: Linux kill and logout users

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 3 comments… read them below or add one }

1 rajdoe 12.12.07 at 1:13 am

Thankssssss man !

2 songshu 07.24.08 at 1:15 pm

Its one of things i hardly ever remember, never mind that i take the effort to write it down, but if you do need it a post like this is worth a million…
thanks

3 The Doctor 06.12.09 at 1:44 am

Works in OpenBSD 4.5 also. Great tip.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: What command do you run to check file system consistency under UNIX or Linux?

Next post: Linux scan wireless card for information