Tilde(~) and Slash(/) character in Linux are meta character. Within the confines of a terminal’s shell, these have special meaning.
Tilde(~) is used to denote a user’s home directory. It contains the path to the current user home directory (it gets expanded to the $HOME env variable).
Above command will print user home directory path.
Tilde expansion is more than home directory lookup. Adding a account’s username takes you to that account’s home directory, assuming you have permissions to view it. For example, the command
cd ~bob takes you to the home of the account named bob. Here’s a summary:
|~bob||bob home dir|
|~+||$PWD (Current working directory)|
|~-||$OLDPWD (Previous directory)|
~-1, etc., are used in conjunction with
Slash character(/) is used by Linux as path separator. It is also used for to represent the root directory.
Above command will bring you to the root directory (topmost directory of your filesystem). The character / can never be part of a filename as it is the path separator.