Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I list all locked users in Linux?

usermod -L user_name

This command locks a particular user. Does Linux have any command that lists locked user?

share|improve this question
up vote 7 down vote accepted

passwd -S -a | grep LK | cut -d " " -f1 and/or passwd -S -a |awk '/LK/{print $1}' should work.

(in case your interested)

Both of these illustrations demonstrate a very common technique that is used throughout Unix/Linux: what I'll call command piping.

In these examples, the output of one command (such as ls is "piped to" another command, which effectively filters its input and sends it down the line.

Refer to for more information.

share|improve this answer
And of course this works only if user data is local, and not in some kind of a database (LDAP, etc.). But I suppose this is what the OP wanted. – haimg Dec 18 '11 at 16:32
@haimg Yes. If you want to edit my question to include that information, feel free. – wizlog Dec 18 '11 at 16:36
sudo awk '/!\*/' /etc/shadow | cut -d : -f1

Another way for local users.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .