How to get full name?

QuestionsQuestions8 SkillsProYour First Linux LabAug, 31 2025
0138

To get the full name of the current user, you can use the getent command along with awk to extract the relevant field. Here's how you can do it:

getent passwd $(whoami) | awk -F: '{print $5}'

This command retrieves the user information from the passwd database and prints the full name, which is usually the fifth field in the output.

0 Comments

no data
Be the first to share your comment!