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:
Only to logout all users except root
There are 5 alternatives - vote for the best!
Logs all users out except root.
I changed the grep to use a regexp in case a user's username contained the word root.
It's only to logout all other user's 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.