getent

getent – get entries from administrative database

The getent program gathers entries from the specified administrative database using the specified search keys. Where database is one of aliases, ethers, group, hosts, netgroup, networks, passwd, protocols, rpc, services or shadow.

 

 

getent hosts <host>

Perform a reverse DNS lookup
getent passwd `whoami` | cut -d ‘:’ -f 5
Prints out, what the users name, notifyed in the gecos field, is
getent passwd | cut -d: -f1 | sort
Lists all usernames in alphabetical order

getent services <<service>>
Query well known ports list

getent passwd $(whoami) | echo “$(perl -ne ‘/^([^:]+):[^:]+:[^:]+:[^:]+:([^ ]+) ?([^,]+)?,([^,]*),([^,]*),([^:,]*),?([^:,]*)/ and printf “MECARD:N:$3,$2;ADR:$5;TEL:$4;TEL:$6;EMAIL:$1@”‘)$HOSTNAME;;” | qrencode -o myqr.png
Create a QR code image in MECARD format
If your contact information was entered when your user account was created (it gets added to /etc/passwd) then this gets that info and creates a QR code for you automatically

commandlinefu.com/commands/using/getent