I am new in linux
. I need to know user name from given user id in my c application. Is there any linux api
function available to get this?
Thanks
I am new in linux
. I need to know user name from given user id in my c application. Is there any linux api
function available to get this?
Thanks
If you want to get the username from a c program then getpwuid
is probably the easiest way.
Man entry here: http://man7.org/linux/man-pages/man3/getpwnam.3.html
From the command line, I would just grep through passwd:
grep 1000 /etc/passwd | cut -f1 -d: