Linux Basics: Moving Around the Terminal
Open a terminal on Debian or Ubuntu. Each command runs in a working directory, which is simply the folder you are currently in. Start by finding it.
Check your location
pwd
ls
ls -lapwd prints the current directory’s path. ls lists its contents. Add -l for details such as permissions and file sizes, and -a to include hidden names beginning with a dot.
The options can be combined: ls -la means the same as ls -l -a.
Move between directories
cd /tmp
pwd
cd ..
pwd
cd ~
pwdExample with /home/user as the home directory; your home path will differ:
/tmp
/
/home/usercd changes directories. /tmp is an absolute path: it starts at the filesystem root, /. After moving to /tmp, cd .. takes you to its parent, /.
~ means your home directory. Running cd without an argument also takes you home.
A relative path starts from your current directory. For example, cd Documents enters a directory named Documents if it exists there. Names are case-sensitive, so Documents and documents can be different directories.
Make typing easier
Press Tab to complete a command or path. Use the up arrow to recall the previous command. Put paths containing spaces in quotes, such as cd "My Notes".
When you get lost, run pwd, inspect the directory with ls, and return home with cd.
References
GNU Coreutils manual · Debian Bash manual
Acknowledgements
This post was created with assistance from AI.
Linux Basics — lesson 1 of 25. Series index
Start here. · Next: Getting Help for Commands