~
is a symbol called virgulilla that in UNIX operating systems refers to the value of the variable $HOME
, that is, the directory of the user that is logged in.
This allows you to reference that directory directly, without having to type /home/usuario/
each time.
If you look at the file /etc/passwd
, there you will see how it is defined for each of the users. Normally it is /home/nombre_de_usuario
, although for root
it is usually /
:
Well, when Bash (or another shell, then is something defined by POSIX ) reads ~
outside of quotation marks, it expands it automatically by the value that is in /etc/passwd
for the user that is executing it.
Therefore, in your particular case, by saying:
php ~/composer.phar require cboden/ratchet
# ^
What will be done is:
php /home/tu_usuario/composer.phar require cboden/ratchet
# ^^^^^^^^^^^^^^^^