Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm starting out on some Linux bash scripting and I'm trying to get the username so I can cd to that user's Desktop:

cd /home/$(user I'm currently using)/Desktop

The code should be similar to the above to my understanding. What kind of terminal command would return just the name of the user I'm using?

share|improve this question

migrated from Aug 21 '12 at 8:45

This question came from our site for professional and enthusiast programmers.

up vote 4 down vote accepted

The command you were looking for is whoami.

share|improve this answer
Cool, thanks this was useful! – Mantas Aug 20 '12 at 12:32

You're probably just looking for cd ~/Desktop.

share|improve this answer
Thank you very much sir, was silly to miss that! – Mantas Aug 20 '12 at 12:29

See Here

[max@localhost ~]$ echo $USER


This will print the name of the user who currently logged in the terminal

[max@localhost ~]$ su -


[root@localhost ~]# echo $USER


share|improve this answer

who is the command for you which is a shortform for whoami

share|improve this answer
who is not short form for whoami who shows who are all logged on the system(means in tty1,tty2 and so on) whoami means who is currently using the system (who is running this command, it always shows your name only because you are running this command, if other person run this command then it will show his name) It always print single name. – max Aug 23 '12 at 11:01

You must log in to answer this question.