Labs ICT
โญ Pro Login

Navigation

If you're going to live in the terminal, you need to get around. In a GUI, you click folders. In Unix, you type. Three commands handle 99% of navigation: pwd, cd, and ls. Let's start with the first two.

Where am I? โ€” pwd

pwd stands for "print working directory." It tells you exactly where you are in the file system right now.


$ pwd
/home/you
    

Your "working directory" is the folder your terminal is currently sitting in. When you run commands or open files, this is the starting point.

Try it Yourself โ†’

Moving around โ€” cd

cd means "change directory." Give it a path and it teleports you there.


$ cd Documents
$ pwd
/home/you/Documents
    

Type cd with no arguments to go straight back to your home directory. It's the shortcut for "take me home."

The shortcuts: . and ..

Every directory has two special entries:

  • . (dot) โ€” this directory. It's not super useful alone, but you'll use it later.
  • .. (dot dot) โ€” the parent directory. Go up one level.

$ pwd
/home/you/Documents/projects
$ cd ..
$ pwd
/home/you/Documents
$ cd ../..
$ pwd
/home
    

You can chain .. to go up multiple levels. ../../.. goes up three directories.

Tab completion

Pro tip: you almost never need to type full paths. Start typing a directory name and press Tab. The terminal fills in the rest. If multiple options match, press Tab twice to see them all. This saves more time than any other trick โ€” use it constantly.

๐Ÿงช Quick Quiz

Which command changes to the home directory when run with no arguments?