(inside the computer)

CIS241

System-Level Programming and Utilities

Linux Filesystems

Erik Fredericks, frederer@gvsu.edu
Fall 2025

Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers

CIS241 | Fredericks | F25 | 3-Filesystems
(weather)

Time to become a terminal wizard

 
 
 
 
 
 


bottom-right (shell)

CIS241 | Fredericks | F25 | 3-Filesystems

The *nux filesystem

Heirarchical

  • Think of it like a tree

top-right (filesystem)

CIS241 | Fredericks | F25 | 3-Filesystems

Important directories

Root: /

Your home directory: /home/username

  • Shortcut to your home: ~

For example, to change the current directory to your home directory:

  • cd /home/username or
  • cd ~
CIS241 | Fredericks | F25 | 3-Filesystems

Paths

We have relative and absolute

Absolute paths - start from the root of the filesystem (/)

  • You can easily access these from anywhere

Relative paths - start from your current location (.)

  • You have to know where you are in the current filesystem!
    • E.g., what folder you are in
    • The command that tells you is pwd (print working directory)
CIS241 | Fredericks | F25 | 3-Filesystems

Useful tip - tab expansion

top-right (tab drink)

If you hit tab the shell will try to autocomplete for you

  • Avoid typing in those pesky filenames
  • E.g., cd /home/fre -> tab -> autoexpands to cd /home/frederer

If the file/path is ambiguous, double-tap tab to get a list of options

CIS241 | Fredericks | F25 | 3-Filesystems

More important directories

  • .: current working directory
  • ..: parent of current directory

What is this? ./../../

CIS241 | Fredericks | F25 | 3-Filesystems

Common commands (with basic usage)

  • cd: Change to another directory
    • Usage: cd directory
  • ls: List contents in directory
    • Usage: ls for current directory or ls directory for somewhere else
      • Is there a difference between ls and ls .?
  • mkdir: Make directory
    • Usage: mkdir newdirectory | Example: mkdir /home/frederer/mynewdirectory/
  • pwd: Show current working directory path
  • touch filename: Create an empty file

Try all of these!!!

 

CIS241 | Fredericks | F25 | 3-Filesystems

How on earth do you remember all this?

Practice!

  • Also, more practice!

Check the man pages!

Search with apropos

  • apropos "remove file"
  • apropos "remote"
  • apropos "ssh"

bottom-right (hmm)

CIS241 | Fredericks | F25 | 3-Filesystems

Some practice

  1. Create a directory in the /tmp folder
  • /tmp is scratch space shared by all on the machine and is regularly deleted
  1. Create a directory named CIS241 in your user directory on EOS

  2. Navigate to the new CIS241 folder in your user directory and create an empty file called TODO

  • Interestingly, Linux doesn't care about extensions.
    • They're only used to help out in the desktop environment
    • File type is determined by the inner header within the file
CIS241 | Fredericks | F25 | 3-Filesystems

More commands!

Use these with caution - deleting / overwriting files in Linux cannot be reversed/undone

  • There is no recycle bin in the shell!

  • rm: Remove file/directory (i.e., delete forever)

    • Usage: rm file
  • cp: Copy file/directory (i.e., copy and paste)

    • Usage cp file1 file2
  • mv: Move file/directory (i.e., cut and paste)

    • Usage: mv file1 file2
  • cat file: Output the contents of a file

 

CIS241 | Fredericks | F25 | 3-Filesystems

Command options (or flags, or arguments, ...)

Most terminal commands accept arguments to change its behavior

Typically delineated with a dash (by convention)

E.g.,:

  • ls -la
    • Equivalent to ls -l -a
    • Meaning, give me the long listing and all information (i.e., hidden info)
  • cp -r
    • Recursively copy (or, how you copy directories and their contents)

Options can be found typically by adding --help or reading the man pages

CIS241 | Fredericks | F25 | 3-Filesystems

THE MANUAL

Linux commands often have an accompanying manual!

  • man <cmd>
    • man cp
    • man ls

 
 
 
 

bottom-right (rtfm)

CIS241 | Fredericks | F25 | 3-Filesystems

Some more practice: bashcrawl

Intended to give you practice navigating in a video game setting

  • Reminiscent of classic terminal games (like Zork)!

I have installed it to my user directory on EOS

CIS241 | Fredericks | F25 | 3-Filesystems

time to become a terminal wizard

mention that this is absolute pathing