Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 trying to locate where some files are stored and I can easily browse to them via ssh by going to "cd ~/foldername", however, I have no idea what directory "~/" actually is.

When I browse around folders via WinSCP (yes, I'm a Windows admin), I can't seem to locate this folder at all.

This is probably the most "noob" question I've ever asked but I've been having a tough time Googling it due to the length and it not actually coming up.

Note: I'm using Amazon Linux on EC2 if it makes any difference.

Thanks in advance.

share|improve this question
up vote 3 down vote accepted

The tilde character is shorthand for the home directory of the current logged-in user. If you are logged in as jason, then ~ is likely /home/jason/. It is the home directory of any username, as given in /etc/passwd. It is also the same as the $HOME environment variable. The expansion from ~ to the home directory is done by the shell.

share|improve this answer
That is what I thought, but I can't seem to locate the folder under my home directory. The full directory I'm looking for it "~/.ec2"...does adding that period make the folder invisible or something? I'm able to browse to it via ssh without issue, but it doesn't show up under WinSCP. – Jason Davis Jan 18 '13 at 18:14
I figured out my issue...I had sudo'ed to the root user to make the file I was looking for, so the folder I was looking for was actually under /root rather than /home/user. This information was helpful in any case though, thanks! – Jason Davis Jan 18 '13 at 18:16
@JasonDavis Right, so ~ for root is root's home directory, which is normally /root. – Christopher Jan 18 '13 at 18:17
It is expanded by the shell, try echo ~. There's not even a folder with that name, because any command getting it as an argument will actually be passed the value of $HOME, not ~. – njsg Jan 18 '13 at 18:25
~ actually expands to the current value of $HOME, not necessarily to the current user's home directory. Normally they'll be the same, but it is possible to modify the value of $HOME. (This is rarely a good idea.) On the other hand, ~foo does expand to the home directory of user foo as defined in /etc/passwd or in your system's equivalent. – Keith Thompson Jan 18 '13 at 19:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.