wEEK 4

Filesystem Navigation & Basic File Management

Why Filesystem Navigation Is the Backbone of Linux Work

Every Linux system runs on a filesystem—the structure that decides where data lives and how it’s retrieved. In IT work, this isn’t optional: sysadmins, developers, and support staff constantly navigate directories, edit configs, and track down logs. If you can’t move confidently through the filesystem, you’ll waste time, risk errors, and struggle in professional environments. Mastering these basics is the foundation for nearly every other Linux skill.

N.A.V.I.G.A.T.E. Framework

This week we’re introducing a new mnemonic to organize everything you’ll do with the Linux filesystem. N.A.V.I.G.A.T.E. gives each big idea its own clearly labeled section, and on the course page each letter will use a distinct background color so you can spot topics at a glance and jump to what you need.

Navigate the tree​

Think of the Linux filesystem like a family tree: it starts at the very top with / (the root directory) and branches down into folders and files. Follow the branches in the image below:

  • At the very top is /. From there, you see branches like /bin, /etc, /usr, and /home.

  • If you follow the /home branch, you’ll see a user folder named test. That’s where this user’s personal files live.

  • Inside test are two main folders: python_homework and study_guides.

    • python_homework contains two files: homework1.py and homework2.py.

    • study_guides splits into subjects: python (with test1.txt, test2.txt) and OS (with its own test1.txt, test2.txt).

  • Meanwhile, on the /usr/bin branch, you can see command programs like ls, vi, and man.

Every file can be described by the “path” you take down the tree. For example:

  • Starting at /hometestpython_homeworkhomework1.py gives the full path /home/test/python_homework/homework1.py.

  • If you’re already sitting in /home/test, you can take a shortcut and use the relative path: python_homework/homework1.py.

Absolute & relative paths​

Once you see the filesystem as a tree, the next question is: how do we describe the location of a file?
In Linux, this is done with paths. A path is just the set of directions you follow down the tree to reach a file or folder. There are a few special rules and shortcuts that make paths easier to use:

Path TypeWhat It MeansExampleIT Relevance
AbsoluteStarts from the root / and spells out the full route./usr/bin/python3Used in scripts and automation for reliability.
RelativeStarts from where you are now in the tree.../images/logo.pngUsed in projects where code moves between systems.
Home (~)Shortcut to your home directory.~/projectsLets users jump quickly to their workspace.

Absolute paths are like street addresses — they work everywhere. Relative paths are like saying “turn left from here” — shorter, but only meaningful if you know where you’re standing.

View Contents

Now that you know how to navigate the filesystem tree, the next skill is to look inside files. Imagine walking through the branches of our tree — when you reach a leaf like homework1.py or test1.txt, you don’t always want to open a heavy text editor just to see what’s inside. Linux gives us lightweight commands to peek at file contents quickly.

CommandWhat It DoesExample using the tree diagram introduced in the “Navigate the tree” sectionWhy Use It
catPrints the whole file to the screen.cat homework1.py (from /home/test/python_homework)Quick for small files, like short homework scripts.
lessOpens the file in a scrollable viewer (press q to quit).less test1.txt (from /home/test/study_guides/python)Useful for longer notes or logs.
headShows the first 10 lines.head test2.txtGood for checking file headers or the start of data.
tailShows the last 10 lines.tail test2.txtHandy for viewing recent log entries or results.
wcCounts lines, words, and characters.wc test1.txtHelpful to get a quick size check.

Navigate the tree​

I — Inodes & Links (Intro)

So far we’ve been walking the filesystem tree: moving between branches (directories) and looking at leaves (files). But here’s something important: in Linux, a file is not just its name on the tree. The real file lives in something called an inode — like a little record card that stores everything about the file: its size, owner, permissions, and where the data blocks are on disk. The name you see in the directory is just a label that points to that inode.

This design lets Linux do some clever things: one file can have multiple labels (hard links), and you can also create shortcuts (symbolic links) that point to files elsewhere. You’ve actually seen this idea before in everyday life: a symlink is like a desktop shortcut to a deep folder, saving you from clicking through 10 levels every time. On professional Linux systems, admins rely on the same trick — for example, the command python may just be a symlink that points to python3.12. And over the long run, knowing that a file’s name and its data are separate helps prevent mistakes: deleting a name (rm hw1_link.py) doesn’t necessarily erase the file itself if another link to it still exists.

Key Concepts:

ConceptMeaningWhy It Matters
InodeA unique record on disk that stores metadata: size, type, owner, permissions, and where the file’s data blocks are.Prevents confusion between name vs. actual file data.
Hard LinkA second name pointing to the same inode.Multiple “labels” for the same file; delete one, the file still exists until all links are gone.
Symbolic Link (symlink)A shortcut that points to another path.Lets you reference files across directories (like desktop shortcuts in Windows).

Commands to Know:

Step 1: Seeing Inodes

Try to imagine that every file in the tree diagram has a hidden number behind it — that number is its inode.

  • To reveal these numbers, we use: ls -i

If you ran this inside /home/test/python_homework, you might see:

131072 homework1.py


131073 homework2.py
 

Here 131072 and 131073 are the inode numbers. They prove each file has its own record card on disk.


Step 2: Hard Links (Multiple Labels to the Same File)

Suppose you want homework1.py to also appear as hw1_link.py in the same folder, without making a copy. That’s a hard link:

  • Command:

     
    ln homework1.py hw1_link.py

Now both homework1.py and hw1_link.py point to the same inode number. Delete one, and the file still exists under the other name.
It’s like writing two labels for the same binder — no matter which label you grab, you’re still opening the same binder.


Step 3: Symbolic Links (Shortcuts)

What if you want quick access to homework2.py, but from a different folder (say, inside study_guides)? That’s where symbolic links (symlinks) come in.

  • Command:

     
    ln -s /home/test/python_homework/homework2.py hw2_symlink.py

This creates a new file called hw2_symlink.py which is really just a pointer to the original.
Unlike hard links, if you delete the original, the symlink breaks (because it was only pointing to the path, not the inode).

Think of a symlink as the “shortcut” icon you’ve seen on desktops in Windows or Mac.

G – Get Organized

So far, we’ve explored the tree and inspected files. Now it’s time to talk about organizing the filesystem: creating new branches, copying or moving files, and cleaning up what you don’t need.

Some of these commands you’ve already met in earlier weeks — but here we’ll place them into the bigger picture of file management as a whole.

Think of it like setting up binders for classes: you buy a new binder (mkdir), put in blank pages (touch), make a photocopy of notes (cp), shift a sheet to the right tab (mv), and recycle old material (rm, rmdir).

Key Concepts:

CommandWhat It DoesExample on DiagramWhy It Matters
mkdirMake a new directory (branch).mkdir projects inside /home/testStart a new folder for assignments.
touchCreate an empty file or update its timestamp.touch notes.txt in study_guidesBegin a new note file.
cpCopy files or directories.cp homework1.py homework1_backup.pyKeep a backup before editing.
mvMove or rename files.mv test1.txt test1_final.txtRename or reorganize files.
rmRemove files.rm test2.txtDelete a file you don’t need.
rmdirRemove empty directories.rmdir old_notesClean up empty folders.

A - Advanced selection​

So far, you’ve been working with files one at a time. But real directories often contain dozens or even hundreds of files. Typing each name individually would be slow and error-prone. That’s where wildcards come in — special characters that let you select groups of files at once.

Imagine standing in the study_guides/python branch of the tree. Instead of listing both test1.txt and test2.txt separately, you can simply say: “all files that end with .txt.” Linux understands this through the * wildcard.

Key Concepts:

WildcardHow to Read ItExample in ContextWhat It Does
*“Anything, zero or more characters”ls *.txtMatches all text files like test1.txt and test2.txt.
?“Exactly one character”ls homework?.pyMatches homework1.py and homework2.py but not homework10.py.
[ ]“Pick from this set of characters”ls test[12].txtMatches test1.txt and test2.txt.
{ }“Choose from these names”cp {notes.txt,plan.txt} backup/Copies both notes.txt and plan.txt at once.

Notice how each pattern saves keystrokes and avoids errors. Instead of typing multiple filenames one by one, you describe a rule, and the shell expands it into the list of files for you.

  • * means “anything, zero or more characters.”  Example: ls *.txt will list every text file in a directory.
  • ? means “exactly one character.” Example: ls homework?.py matches homework1.py and homework2.py but not homework10.py.
  • [ ] lets you pick from a set of characters. 

    Example: ls test[12].txt matches only test1.txt and test2.txt.
  • { } lets you spell out multiple names at once. Example: cp {notes.txt,plan.txt} backup/ copies both files together.

T – Track Location

Once you start moving around the tree, the next challenge is: how do you know where you are right now?
Linux gives you simple commands to keep track of your location — think of them as your GPS inside the filesystem.

CommandWhat It Tells YouExample UseWhy It Matters
pwdPrints your current location in the tree./etc/nginx/sites-enabledPrevents mistakes when editing configs.
cdMoves you to a different branch.cd /var/logLets engineers jump into logs quickly.
.Refers to “here.”./deploy.shRuns a script in the current folder.
..Refers to “up one level.”cd ..Saves time when navigating deep folders.
~Always means “home.”cd ~Quick return to your safe workspace.

These commands keep you oriented. Before making changes on a server, professionals always confirm their location — a simple pwd can prevent deleting or editing the wrong files.

E – Evaluate Space

Once you start storing files in the filesystem, the next question is: how do we measure how much space they use?
In Linux, this is done with a few commands that report size, usage, and available storage. These tools help you understand not just where files are, but how much room they take up.

CommandWhat It ShowsExample UseWhy It Matters
ls -lhLists files with human-readable sizes.Shows 2.1K instead of 2140.Helps quickly compare file sizes in a folder.
du -shDisk usage of a directory.du -sh /home/test/study_guidesLets admins check which folders are taking the most space.
du -sh *Usage of everything in the current folder.Breaks down size by subdirectory.Helps identify which subfolders are growing too large.
df -hFree space on mounted filesystems.Shows capacity of /, /home, etc.Crucial for monitoring storage before it fills up.

Being able to check disk usage is critical in IT work. Logs, backups, and user files can silently grow until the system runs out of space — and when that happens, services may crash or refuse to start. A quick du or df is often the first step in troubleshooting storage issues.

Scroll to Top