Skip to content

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

PathDescription
/Root directory (top-level of the file system)
/home/usernameYour personal user directory (on WSL: /home/<your-ubuntu-username>)
/mnt/cMount point for your Windows C: drive in WSL
/mnt/dMount 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:

CommandDescriptionExample
pwdPrint Working Directory — shows your current locationpwd/home/user/projects
lsList files and folders in the current directoryls
ls -lLists files with details (permissions, size, date)ls -l
ls -aLists all files, including hidden onesls -a
cd folder_nameChange directorycd simulations
cd ..Move up one levelcd ..
cd \Go to home directorycd \
cd /mnt/d/codesAccess Windows drive from WSLcd /mnt/d/codes
clearClear the terminal screenclear

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:

CommandDescriptionExample
mkdir folder_nameCreate a new foldermkdir fenics_projects
rmdir folder_nameRemove an empty folderrmdir old_folder
rm -r folder_nameDelete a folder and its contents (use with caution)rm -r test_folder
touch file_nameCreate a new empty filetouch notes.txt
cp source destinationCopy files or folderscp data.txt backup/data.txt
mv source destinationMove or rename files or foldersmv beam.py simulations/beam.py

Tips:

  • Use rm -r carefully, 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.