Directories and Folders

In the terminal, directories are the same thing as folders in Windows. It's just a different name for the same concept - a container that holds files and other directories.

In Windows, you click through folders in File Explorer. In the terminal, you type commands to move around. It feels different at first, but the underlying structure is the same: files organised into folders (directories) in a tree structure.

How Linux Organises Files

Linux organises files differently from Windows. Instead of drives like C:\ and D:\, everything starts from a single root directory called /. Think of it as one big tree where / is the trunk and everything branches off from there.

Your Home Directory

Your home directory is /home/yourusername, often abbreviated as ~ (tilde). This is where your personal files, settings, and projects live.

Ubuntu
cd ~

This command takes you home from anywhere. cd means "change directory".

Understanding Paths

There are two types of paths:

Absolute Paths

Start from the root / and specify the complete location:

  • /home/john/projects/myapp
  • /etc/nginx/nginx.conf

Relative Paths

Relative to your current location:

  • projects/myapp - folder inside current directory
  • ./myfile.txt - file in current directory
  • ../other - folder in parent directory
Command Action
pwd Print working directory (where am I?)
ls List files in current directory
ls -la List all files with details
cd folder Go into a folder
cd .. Go up one level (parent directory)
cd ~ Go to home directory
cd - Go to previous directory

Using zoxide (Smart cd)

The bootstrap script installed zoxide, which remembers directories you visit. After you've visited a directory once, you can jump to it from anywhere:

Ubuntu
z myapp

Instead of typing cd ~/projects/frontend/myapp, just type z myapp and zoxide will figure out which directory you mean.

Interactive selection with zi

Type zi to open an interactive fuzzy finder of all directories zoxide knows about. Great when you can't remember the exact name.

Accessing Windows Files

Your Windows files are accessible from WSL at /mnt/c/ (for the C: drive):

Ubuntu
cd /mnt/c/Users/YourName/Documents
Performance warning

Working with files on /mnt/c/ is much slower than working within the Linux filesystem. For development projects, always create them in your Linux home directory (~).

Creating Directories

Ubuntu
mkdir projects

Creates a new directory called "projects".

Ubuntu
mkdir -p projects/web/myapp

Creates nested directories. The -p flag creates parent directories as needed.

Important Linux Directories

Directory Purpose
~ Your home directory
~/.config Application configuration files
~/.local/bin User-installed programs
/tmp Temporary files (cleared on reboot)
/etc System configuration files
/usr/bin System programs