Linux lid Command Examples

Posted on in Categories , , , last updated January 30, 2014
lid command

I am a new Linux and Unix system user. How do I list the user’s groups or group’s users on Linux operating systems? How can I show list of users belonging to a given group on Linux based server?

You need to use the lid (list ID) command to show information about groups containing user name, or users contained in group name at a shell prompt. This command is just like groups command which

lid command details
DescriptionShows users belonging
to a given group.
Root privilegesYes
Estimated completion time1m
list a user’s group memberships or members command which outputs members of a group on Linux operating system. This command may not be available on other Unix-like operating systems.


Displays the group that a given user belongs to on Linux operating systems.


The basic syntax is as follows:

lid userNameHere


lid [options] userNameHere

This command must be run with superuser privileges other wise you will get an error that read as follows:

No user name specified, using nixcraft.
Error initializing libuser: not executing with superuser privileges.

Warning: On Debian and Ubuntu Linux based system you need to use the apt-get command to install lid command
sudo apt-get install libuser

lid command examples

If you skip user name on command line, lid lists information about the invoking user (also know as the current user). Just type the following command:
$ sudo lid
# lid
Sample outputs:

Fig. 01: lid command in action
Fig. 01: lid command in action

By default lid displays groups containing the invoking user if user-name is not specified on command line.

How do I list users in a group name?

To Show users in a group, enter:
# lid -g {groupNameHere}
To see users of members of ‘webmaster’ group, enter:
# lid -g webmaster
Sample outputs:


How do I hide GID/UID?

By default the user IDs (UID) or group IDs (GID) are displayed by lid command. To hide UID/GID pass the -n option:
# lid -n {name}
# lid -n nixcraft
# lid -n -g webmaster

Sample outputs:


lid command options

From the lid(1) command man page:

Prompt for all information.
List members of a named group instead of the group memberships for the named user.
Only list membership information by name, and not UID/GID.
Show this help message on screen.
--usageDisplay brief usage message.
See also
  • /etc/group file.
  • lid(1)
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdighostip
Package Managerapkapt
Processes Managementbgchrootdisownfgjobskillkillallpwdxtimepidofpstree
User Informationgroupsidlastlastcommlognameuserswwhowhoamilidmembers

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 1 comments/add one below):

1 comment

    Have a question? Post it on our forum!