Search code examples
linuxredhat

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


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?


Solution

  • ~ 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