how to get real user name

I know that in order to get a real user name I should use the following command: cut -d: -f5 /etc/passwd. But how can I get the real user name for those users who are currently logged in to the system??? :confused: Can somebody help me???

who | awk -F' ' '{ print $1 }' | sort | uniq > list2; while read record; do cat /etc/passwd | grep $record | cut -d: -f5; done < list2; rm list2

:slight_smile:

This will give you more information of who is logged in -- just cut what you need:

finger -fs `who -q | egrep -v '# users'`

Thanks for your hint but is it possible to do this without using the 'awk' command???