commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Logs all users out except root.
I changed the grep to use a regexp in case a user's username contained the word root.
There is 1 alternative - vote for the best!
It's only to logout all other user's except "root"
Only to logout all users except root
This command logs out all users - which is way more secure to use ps -ef and "grep" to kill processes.
Never ever use ps -ef piped to grep to kill something. If you ever need to ps-something use the UNIX95-directive, which makes sure you will never need "grep" together with "ps".
If you can do better, submit your command here.
You must be signed in to comment.