CIS126RH | RHEL System Administration 1 Mesa Community College
Learning Objectives
1
Understand the FHS structure
Learn the purpose of major directories in the hierarchy
2
Navigate with paths
Use absolute and relative paths effectively
3
Master navigation commands
Use pwd, cd, ls, and tree to explore the filesystem
4
Locate important system files
Know where to find configs, logs, binaries, and data
The Filesystem Hierarchy Standard
The Filesystem Hierarchy Standard (FHS) defines the directory structure and contents in Unix-like operating systems. It provides predictability - administrators know where to find files regardless of which Linux distribution they use.
Key Principles:
Single root (/) hierarchy
Everything is a file
Separation of static vs variable data
Separation of shareable vs local data
Benefits:
Consistent across distributions
Easier system administration
Simplified software packaging
Clear organization of data
The Root Directory
/← Root of the entire filesystem ├──bin/Essential user binaries ├──boot/Boot loader files, kernel ├──dev/Device files ├──etc/System configuration ├──home/User home directories ├──root/Root user's home ├──tmp/Temporary files ├──usr/User programs and data └──var/Variable data (logs, spool)
Note: The root directory (/) is different from the root user's home directory (/root).
Essential Directories Part 1
Directory
Purpose
Examples
/bin
Essential user commands
ls, cp, mv, cat, bash
/sbin
Essential system binaries
fdisk, fsck, init, ip
/boot
Boot loader and kernel
vmlinuz, initramfs, grub2
/dev
Device files
sda, tty, null, random
/etc
System configuration
passwd, fstab, ssh/sshd_config
/lib, /lib64
Essential shared libraries
libc.so, ld-linux.so
RHEL 9 Note: /bin, /sbin, /lib, /lib64 are now symlinks to their equivalents under /usr.
Essential Directories Part 2
Directory
Purpose
Examples
/home
User home directories
/home/student, /home/admin
/root
Root user's home directory
.bashrc, .ssh/
/tmp
Temporary files (cleared on boot)
Session data, downloads
/var
Variable data
logs, mail, databases
/proc
Process and kernel information (virtual)
cpuinfo, meminfo, [pid]/
/sys
Device and kernel information (virtual)
block/, class/, devices/
⚠ Important: /proc and /sys are virtual filesystems - they don't exist on disk but provide real-time system information.
The /usr Directory
/usr (Unix System Resources) contains the majority of user applications, libraries, and documentation. It's often the largest directory on a system.
/usr/ ├──bin/User commands (merged with /bin) ├──sbin/System admin commands (merged with /sbin) ├──lib/Libraries for /usr/bin, /usr/sbin ├──lib64/64-bit libraries ├──local/Locally installed software ├──share/Architecture-independent data │ ├──doc/Documentation │ └──man/Manual pages └──src/Source code
The /var Directory
/var contains variable data - files that change during normal system operation, like logs, mail spools, and database files.
/var/log
System and application log files (messages, secure, audit)
/var/tmp
Temporary files that persist across reboots
/var/spool
Queued data (print jobs, mail, cron)
/var/lib
Application state data (databases, package info)
/var/cache
Application cache data (dnf, man-db)
/var/www
Web server document root (Apache/Nginx)
The /etc Directory
/etc (Editable Text Configuration) contains system-wide configuration files. This is where administrators spend much of their time.
/etc/passwd
User account information
/etc/shadow
Encrypted passwords (restricted access)
/etc/fstab
Filesystem mount configuration
/etc/ssh/
SSH server and client configuration
/etc/sysconfig/
RHEL-specific system configuration
/etc/systemd/
Systemd unit file overrides
Pro Tip: Always back up files in /etc before editing. Use cp file file.bak before making changes.
Absolute vs Relative Paths
Absolute Path
Starts from root (/) Complete path to file Works from anywhere
/home/student/documents/report.txt
Relative Path
Starts from current directory Shorter to type Context-dependent
documents/report.txt
# Absolute path - starts with /
cat /etc/passwd
cd /var/log
# Relative path - from current directory[student@server ~]$ cd documents
[student@server documents]$ cat report.txt
# Special relative references
. # Current directory
.. # Parent directory
~ # Home directory
Path Examples
# Starting position: /home/student[student@server ~]$ pwd
/home/student# Relative navigation[student@server ~]$ cd documents # → /home/student/documents[student@server documents]$ cd .. # → /home/student[student@server ~]$ cd ../admin # → /home/admin[student@server admin]$ cd ~ # → /home/student# Absolute navigation[student@server ~]$ cd /var/log # → /var/log[student@server log]$ cd /etc/ssh # → /etc/ssh# Return to previous directory[student@server ssh]$ cd - # → /var/log/var/log
Navigation: pwd and cd
# pwd - Print Working Directory
pwd
/home/student# cd - Change Directory
cd /var/log # Go to absolute path
cd log # Go to subdirectory (relative)
cd .. # Go to parent directory
cd ../.. # Go up two levels
cd # Go to home directory
cd ~ # Go to home directory (explicit)
cd ~username # Go to another user's home
cd - # Go to previous directory# Common mistake: space in path
cd /home/My Documents # ERROR - sees two arguments
cd "/home/My Documents" # Correct - quoted
cd /home/My\ Documents # Correct - escaped space
Listing Files: ls
# Basic listing
ls # List current directory
ls /etc # List specific directory# Common options
ls -l # Long format (permissions, size, date)
ls -a # Show hidden files (starting with .)
ls -la # Long format + hidden files
ls -lh # Human-readable sizes (K, M, G)
ls -lt # Sort by modification time
ls -ltr # Sort by time, reversed (oldest first)
ls -R # Recursive listing
ls -d */ # List only directories# Output example
ls -lh /etc/passwd
-rw-r--r--. 1 root root 2.3K Dec 1 10:30 /etc/passwd
Understanding ls -l Output
-rw-r--r--.1rootroot2.3KDec 1 10:30/etc/passwd
Field
Example
Meaning
File type + permissions
-rw-r--r--
Regular file, owner read/write, others read
Link count
1
Number of hard links
Owner
root
User who owns the file
Group
root
Group that owns the file
Size
2.3K
File size (with -h)
Modified
Dec 1 10:30
Last modification date/time
Visualizing with tree
# Install tree (if not present)
sudo dnf install tree
# Basic tree view
tree /etc/ssh
/etc/ssh
├── moduli
├── ssh_config
├── ssh_config.d
│ └── 50-redhat.conf
├── sshd_config
└── sshd_config.d
└── 50-redhat.conf# Useful options
tree -L 2 # Limit depth to 2 levels
tree -d # Directories only
tree -a # Show hidden files
tree -h # Show file sizes
tree -p # Show permissions
tree --dirsfirst # List directories before files
Special Directories
/proc
Virtual filesystem for process and kernel information. /proc/cpuinfo, /proc/meminfo, /proc/[pid]/
/sys
Virtual filesystem for device and driver information. Used for hardware configuration.
/run
Runtime data since boot. PID files, sockets, tmpfs mounted. Cleared on reboot.
/mnt
Temporary mount point for manual mounts. Convention for admin-mounted filesystems.
/media
Mount point for removable media. USB drives, DVDs auto-mount here.
/opt
Optional software packages. Third-party applications often install here.
Finding Your Way
# Where am I?
pwd
# What's here?
ls -la
# What's in subdirectories?
tree -L 2
# Where is a command?
which python
/usr/bin/python
whereis bash
bash: /usr/bin/bash /usr/share/man/man1/bash.1.gz# Where is a file?
locate passwd # Fast (uses database)
find /etc -name "passwd" # Thorough (searches live)# What type is this?
file /etc/passwd
/etc/passwd: ASCII text
Tab Completion
Tab completion automatically completes commands, paths, and filenames when you press the Tab key - saving time and preventing typos.
# Type partial path, press Tab to complete
cd /etc/sys[TAB]
cd /etc/sysconfig/ # Completed!# Multiple matches? Press Tab twice to list options
cd /etc/sys[TAB][TAB]sysconfig/ sysctl.conf sysctl.d/ systemd/# Works with commands too
syste[TAB]
systemctl # Completed!# And with options (in bash-completion)
systemctl st[TAB][TAB]start status stop
Pro Tip: Use Tab obsessively - it's faster, avoids typos, and confirms paths exist.
Key Takeaways
1
The FHS provides a consistent directory structure across Linux systems
2
Absolute paths start with /, relative paths start from current directory
3
Key commands: pwdcdlstree
4
Know where to find: /etc (config), /var/log (logs), /home (users), /usr (programs)
Graded Lab
Navigate to /var/log and list files sorted by modification time
Use tree to visualize the /etc/ssh directory structure
Find all files named "passwd" anywhere on the system
Practice using relative paths with .. and . to navigate