You can determine the name of a user who is logged in using a number of different methods. From the command line there are two commands that most commonly get used for this: logname and whoami. Each can be used without any arguments to return the name of the user running the command, a great way to debug scripts, or grab the name of a user. To use logname:
logname
To use whoami:
whoami