It just give the username and not the display name and the password. I need something that could give me username together with the display name and/or the password
You can't get the password easily. The passwords are stored in an encrypted form in the root-readable-only file /etc/master.passwd, encrypted with crypt(3).
awk comes in handy for parsing text files that have a unique field separator. For /etc/passwd and /etc/master.passwd, the colon ) is the field separator. So all you need to do is figure out which field(s) to print, and tell awk to print them:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.