~ is home
The shell replaces ~ with your home folder before a command runs, so ~/projects always means the same place whatever folder you are in.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Home is where your settings, your downloads and usually your code live. Paths that start with ~ work from anywhere.
How to think about it
Use ~ for anything of yours; use / for the root of the machine; use nothing for something in the current folder.
Worked example
echo ~Prints your home path, starting with a slash.
cd ~Go there.
pwdThe same path.
Your turn
Move into the projects folder inside your home.
cd /projects
Try it at a real prompt
The trap
Quoting the tilde: cd "~/projects" looks for a folder literally called ~. The shell only expands an unquoted ~.
Practise ~ (home) on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.