Linux logout user or logoff user commands

by Vivek Gite on May 15, 2007 · 9 comments

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

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 9 comments… read them below or add one }

1 rajdoe December 12, 2007

Thankssssss man !

Reply

2 songshu July 24, 2008

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

Reply

3 The Doctor June 12, 2009

Works in OpenBSD 4.5 also. Great tip.

Reply

4 Wildcard September 2, 2009

Whow, thanks for this posting! Just what I needed, highly appreciated!

Reply

5 Husen June 7, 2010

Thanks, I was looking for such a command

Reply

6 harris March 5, 2011

i want to show the login time and logout time of all users then i will sort it according to their name help me pls…

Reply

7 Mehdi May 6, 2011

Thanks a lot!
pkill worked fine in the GUI session!
Regards;

Reply

8 Mohamad Aqashenas September 14, 2011

Thanks a lot.
I found here very usefull information about my quistions.
Best regards.

Reply

9 yaw October 6, 2011

what’s the KILL flag do?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 6 + 2 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the simple math so we know that you are a human and not a script.



Previous post:

Next post: