Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ~/ and ~ in Linux?

Tags:

linux

redhat

I am novice to Linux, using it a little more than a year. Can anybody help me resolve my question?

When I use ~/ only it shows user home directory. Why does it not work in the case of using ~ alone to specify path to a file or directory?

like image 530
Gowthaman Palanisamy Avatar asked Aug 28 '15 06:08

Gowthaman Palanisamy


1 Answers

~ means the home directory of the logged on user whereas ~/ means the path to the beginning of a directory.

From here:

The tilde (~) is a Linux "shortcut" to denote a user's home directory. Thus tilde slash (~/) is the beginning of a path to a file or directory below the user's home directory.

On a side note If you see like ~Gowthaman/ then it will be the user Gowthaman home directory

like image 111
Rahul Tripathi Avatar answered Nov 12 '22 08:11

Rahul Tripathi