The tilde is not an alias, it's part of bash's shell expansion (just like
$((1 + 2))).
Bash tilde expansion supports the following tilde-prefixes:
~ The value of $HOME
~fred/foo The subdirectory foo of the home directory of the user fred
~N The string that would be displayed by `dirs +N'
~+N The string that would be displayed by `dirs +N'
~-N The string that would be displayed by `dirs -N'
dirs uses the directory stack. You can use
pushd to add a directory to it.
To answer your specific question about
~~, yes, it is possible to map a directory to it. Just create a user called
~ and set
/mnt/photon/work/foo_project/ as its home directory:
sudo useradd '~'
sudo sed -i 's#:/home/~:[^:]*$#:/mnt/photon/work/foo_project:/bin/false#' /etc/passwd
Of course, a much "saner" approach is just defining a shell variable that points to your directory in your
~/.bashrc with the command
which can be accessed via
$foo, as usual.