Viewing information about your user on Linux.

Posted: May 6, 2012. At: 7:39 PM. This was 5 years ago. Post ID: 3745

View information about your user on a Linux system

The groups command displays the list of groups that your user is a member of.

[neo@deusexmachina]:~> groups
neo cdrom floppy audio dip video plugdev bluetooth scanner netdev

Using the id command will display a more verbose output that shows the uid and name of the currently logged in user, the current group that the user is joined to at the moment and the other groups that the user is a member of.

[neo@deusexmachina]:~> id
uid=1000(neo) gid=1000(neo) groups=1000(neo),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),106(bluetooth),108(scanner),110(netdev)

This is my /etc/group file. The syntax is very simple. It has: Group Name : GID : username1,username2,username3,. Adding a new group is easy with either the groupadd command or by editing the /etc/group file directly. You must ensure that you use a unique GID for your new group and that it is a higher number than other GID numbers already in use.

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:neo
floppy:x:25:neo
tape:x:26:
sudo:x:27:
audio:x:29:neo,pulse,timidity
dip:x:30:neo
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:neo
sasl:x:45:
plugdev:x:46:neo
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
Debian-exim:x:103:
mlocate:x:104:
messagebus:x:105:
bluetooth:x:106:neo
fuse:x:107:
scanner:x:108:saned,neo
utempter:x:109:
netdev:x:110:neo
saned:x:111:
ssl-cert:x:112:
neo:x:1000:
gordon:x:1001:
gdm:x:113:
colord:x:114:
pulse:x:115:
pulse-access:x:116:
rtkit:x:117:
lightdm:x:118:
ssh:x:119:
timidity:x:120:
lpadmin:x:121:
avahi:x:122:
zeroinst:x:123:
ntp:x:124:
vboxusers:x:125:

The finger command may also be used to view information about your user very quickly.

[neo@deusexmachina]:~> finger -lmps
Login: neo            			Name: John Cartwright
Directory: /home/neo                	Shell: /bin/tcsh
On since Sun May  6 18:59 (EST) on pts/0 from :0.0
New mail received Sun May  6 12:27 2012 (EST)
     Unread since Thu Apr 19 19:58 2012 (EST)
[neo@deusexmachina]:~>

These two commands are also useful, the former maybe more than the latter.

[neo@deusexmachina]:~> w
 19:21:12 up 1 day, 23:03,  1 user,  load average: 0.00, 0.02, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
neo      pts/0    :0.0             18:59    0.00s  0.03s  0.00s w
 
[neo@deusexmachina]:~> who am i
neo      pts/0        May  6 18:59 (:0.0)
[neo@deusexmachina]:~>

No comments have been made. Use this form to start the conversation :)

Leave a Reply