1

Tip #499   Get real names of current users

The line below will give you the real names of the users currently logged in:

grep -f <(w -h|awk '{print $1}') <(getent passwd) | awk -F":" '{print $5}'