Chapter 4. User, Group and Permission

Id and groups (Check User ID and Group)

Id and groups (Check User ID and Group)
Tag:

The id command

The id and groups commands are used to check user ID and Group information. The id command returns three types of information.

  • User ID
  • Primary Group ID and name
  • List of Groups' that the user belongs to

This is an example result of the id command.

Command Line - INPUT
id
Command Line - RESPONSE
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(flop
py),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),118(lxd)

The groups command

The groups command returns only the list of groups that the user belongs to.

When you run the command without a user name, the command returns the current user's information. This command is useful to check the latest status when you change a user or group setting.

This is an example result of the group command.

Command Line - INPUT
groups
Command Line - RESPONSE
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd

The id command

The id and groups commands are used to check user ID and Group information. The id command returns three types of information.

  • User ID
  • Primary Group ID and name
  • List of Groups' that the user belongs to

This is an example result of the id command.

Command Line - INPUT
id
Command Line - RESPONSE
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(flop
py),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),118(lxd)

The groups command

The groups command returns only the list of groups that the user belongs to.

When you run the command without a user name, the command returns the current user's information. This command is useful to check the latest status when you change a user or group setting.

This is an example result of the group command.

Command Line - INPUT
groups
Command Line - RESPONSE
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd
Tag: