Appearance
Navigating the File System
Before running simulations or using tools like FEniCS and Docker, it’s essential to be comfortable working in the terminal — whether you’re using WSL (Ubuntu on Windows) or macOS Terminal. The terminal allows you to navigate, organize, and manage your files efficiently without relying on a graphical interface.
This section introduces the most important file system navigation commands that you’ll use regularly while working in a Linux-based environment.
Opening the Terminal
On WSL (Windows)
- Press Windows + S, type Ubuntu, and hit Enter.
- This opens your Linux shell inside Windows.
On macOS
- Press Command + Space, type Terminal, and hit Enter.
You’re now in your system’s command-line environment.
Understanding the File System Structure
Linux and macOS both use a hierarchical directory structure (tree-like), starting from the root directory /. Some key locations you’ll often encounter are:
Common File System Paths
| Path | Description |
|---|---|
/ | Root directory (top-level of the file system) |
/home/username | Your personal user directory (on WSL: /home/<your-ubuntu-username>) |
/mnt/c | Mount point for your Windows C: drive in WSL |
/mnt/d | Mount point for your Windows D: drive in WSL |
~ | Shortcut for your current user’s home directory |
. | Refers to the current directory |
.. | Refers to the parent directory |
Basic Navigation Commands
These are the essential commands for moving around the file system:
| Command | Description | Example |
|---|---|---|
pwd | Print Working Directory — shows your current location | pwd → /home/user/projects |
ls | List files and folders in the current directory | ls |
ls -l | Lists files with details (permissions, size, date) | ls -l |
ls -a | Lists all files, including hidden ones | ls -a |
cd folder_name | Change directory | cd simulations |
cd .. | Move up one level | cd .. |
cd \ | Go to home directory | cd \ |
cd /mnt/d/codes | Access Windows drive from WSL | cd /mnt/d/codes |
clear | Clear the terminal screen | clear |
Creating and Managing Folders and Files
When working with simulations, you’ll frequently create directories to organize meshes, scripts, and results.
Here are essential commands for creating, removing, copying, and moving files and directories:
| Command | Description | Example |
|---|---|---|
mkdir folder_name | Create a new folder | mkdir fenics_projects |
rmdir folder_name | Remove an empty folder | rmdir old_folder |
rm -r folder_name | Delete a folder and its contents (use with caution) | rm -r test_folder |
touch file_name | Create a new empty file | touch notes.txt |
cp source destination | Copy files or folders | cp data.txt backup/data.txt |
mv source destination | Move or rename files or folders | mv beam.py simulations/beam.py |
Tips:
- Use
rm -rcarefully, as it will permanently delete the folder and all its contents. - You can copy entire directories with
cp -r source_folder destination_folder. - To rename a file, use
mv old_name new_name.
These commands help you organize your project structure and manage files efficiently from the terminal.
Useful Tips
Press Tab for auto-completion — it helps avoid typing long file names.
Use ↑ (Up Arrow) to cycle through previous commands.
You can drag and drop file paths directly into the terminal (on macOS) to paste their location.
Combine commands using
&&to execute them in sequence. For example:cd /mnt/d/codes && ls
Summary
Mastering terminal navigation is the foundation of efficient simulation work. With just a few commands — cd, ls, pwd, and mkdir — you can move through directories, organize your files, and prepare your workspace for running FEniCS, Docker, and other tools.
In the next section, we’ll explore how to manage files and permissions, ensuring smooth interaction between your WSL environment and your local drives.