by default ~
is given the value of /home/username/
i.e. If I use the command cd ~
it goes to the directory /home/username/
How to change the value of it to some other file such as /home/username/filename?
I do know that this can be dangerous, I am working on a CTF though, so it is fine.
Taken from this U&L question.
Try to change the
$HOME
variable , because tilde (~
) is a short form of$HOME
, or change your user's home directory in/etc/passwd
but that's not recommended.Why you don't try to make and alias for
cd /home/username/filename
like this:Now when you type
documents
it will change to/home/user/Documents
More info in
man alias
.To make that alias permanent, check this question.