The id
and groups
commands are used to check user ID and Group information. The id
command returns three types of information.
This is an example result of the id
command.
id
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 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.
groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd
The id
and groups
commands are used to check user ID and Group information. The id
command returns three types of information.
This is an example result of the id
command.
id
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 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.
groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd