Did you recently create a new user and delete an old user on the machine?
OS X will assign each user an ID, starting with 501,502,503,etc, and a corresponding group to match. So if you've recently deleted a user, OS X wouldn't find it, and therefore display "unknown" as the user's name.
Terminal will always display the user's ID rather than the name.