Session 1: Linux Fundamentals & Navigation
Master the essential Linux navigation skills that form the foundation of all IoT development work. Learn to navigate file systems, understand directory structures, and use fundamental commands with confidence in professional IoT environments.
Prerequisites Check
This is the foundation session - no prior Linux experience required!
- Basic computer literacy
- Familiarity with file and folder concepts
- Understanding of what IoT (Internet of Things) means
Session Learning Objectives
By the end of this session, you will be able to:
Navigate Linux File Systems
Use cd, pwd, and ls commands to move through directories and understand your location in the file system.
Understand Directory Structures
Recognize common directory layouts in Linux systems and know where to find configuration files, logs, and applications.
Use Path Concepts Effectively
Distinguish between absolute and relative paths, and use them efficiently in development workflows.
Apply Professional Command-Line Practices
Use command history, tab completion, and other efficiency techniques used in professional environments.
1. Understanding the Linux File System - Foundational Concepts
Industry Insight: Why Linux File System Knowledge Matters for IoT
Real-World Context: Every IoT device you'll work with - from Raspberry Pi sensors to industrial gateways - uses Linux file systems. Understanding how to navigate these systems is essential for configuring devices, troubleshooting issues, and deploying applications.
Professional Impact: IoT engineers spend significant time working with remote devices via SSH. Efficient navigation skills directly impact your productivity and ability to diagnose problems quickly in production environments.
Linux File System Hierarchy - System Perspective
Linux organizes files in a hierarchical tree structure starting from the root directory (/). Understanding this structure is crucial for development because different types of files are stored in specific locations.
2. Essential Navigation Commands - Your Toolkit
The pwd Command - "Print Working Directory"
The pwd command shows your current location in the file system. This is essential when working with devices remotely, as you need to know exactly where you are before running commands or accessing files.
# Basic pwd usage
pwd # Shows current directory path
/root # Example output in Alpine Linux
# Professional usage examples
pwd > current_location.txt # Save current path to file
echo "Working in: $(pwd)" # Include path in log messages
ls "$(pwd)" # List contents of current directory explicitly
The ls Command - "List Directory Contents"
The ls command is your primary tool for seeing what files and directories exist. You'll use ls constantly to check for configuration files, log files, and installed applications.
# Basic ls variations
ls # Simple list
ls -l # Long format with details
ls -la # Long format including hidden files
ls -lh # Human-readable file sizes
ls -lt # Sort by modification time
ls -lS # Sort by file size
# System-specific ls usage
ls /etc/ # List configuration files
ls -la /var/log/ # Check log files (including hidden)
ls -lh /opt/ # Check optional software directory
ls -lt ~/ # List home directory by newest first
The cd Command - "Change Directory"
The cd command moves you between directories. Mastering cd is essential because you'll constantly navigate between configuration directories, project folders, and system locations.
# Basic cd usage
cd /path/to/directory # Go to specific directory
cd .. # Go up one level (parent directory)
cd ../.. # Go up two levels
cd ~ # Go to home directory
cd - # Go back to previous directory
cd # Go to home directory (same as cd ~)
# Professional navigation techniques
cd /etc && ls -la # Change directory and list in one command
cd ~/$(date +%Y) 2>/dev/null || mkdir -p ~/$(date +%Y) && cd ~/$(date +%Y) # Create and navigate to year folder
3. Understanding Paths - Absolute vs Relative
Path Concepts for Development
Understanding paths is crucial for development because you'll work with configuration files, scripts, and data files across different directories. Knowing when to use absolute vs relative paths can prevent many common errors.
⚠️ Common Path Mistakes in Development
Confusing absolute and relative paths in scripts
Problem: Script works in development but fails in production due to different working directories
Solution: Use absolute paths for critical files or use $(dirname "$0") to make paths relative to script location
Not understanding current working directory
Problem: Commands fail because you're not in the expected directory
Solution: Always use pwd to check location before running important commands
4. Professional Command-Line Efficiency
Command History and Shortcuts
Professional developers use command-line efficiency techniques to work faster and avoid repetitive typing. These skills become essential when managing multiple devices remotely.
# Command history navigation
history # Show command history
!! # Repeat last command
!n # Repeat command number n from history
!string # Repeat last command starting with 'string'
# Tab completion (essential for efficiency)
cd /et[TAB] # Completes to /etc/
ls /var/lo[TAB] # Completes to /var/log/
# Command line editing shortcuts
Ctrl+A # Move to beginning of line
Ctrl+E # Move to end of line
Ctrl+U # Delete from cursor to beginning
Ctrl+K # Delete from cursor to end
Ctrl+W # Delete previous word
Ctrl+L # Clear screen (same as 'clear')
🎯 Comprehensive Navigation Challenge
Put all your navigation skills together in this comprehensive challenge that simulates real development tasks. Copy and paste this entire sequence into the Alpine Linux terminal:
# Navigation Challenge - Complete all tasks
echo '=== Navigation Challenge ==='
echo 'Task 1: System Exploration'
pwd
cd /
ls
cd /etc
ls | head -5
echo 'Task 2: Create Project Structure'
cd ~
mkdir -p projects/sensor-data/{logs,config,scripts}
cd projects/sensor-data
ls -la
echo 'Task 3: Practice Path Navigation'
cd logs
pwd
cd ../config
pwd
cd ~/projects/sensor-data/scripts
pwd
cd -
pwd
echo 'Task 4: Create test files'
touch sensor1.log sensor2.log config.json
ls -la
ls -lt
echo 'Challenge Complete! You have mastered Linux navigation basics.'
📋 Knowledge Check
Question 1: Navigation Commands
Which command shows your current directory location?
Question 2: Path Types
What type of path is "/root/projects/sensor.py"?
Question 3: Directory Knowledge
Where would you typically find service configuration files?
Session Summary & Next Steps
What You've Learned
Congratulations! You've mastered the fundamental Linux navigation skills essential for development:
- File System Understanding: You know the Linux directory hierarchy and where system files are typically stored
- Navigation Commands: You can confidently use pwd, ls, and cd to move around Linux systems
- Path Concepts: You understand the difference between absolute and relative paths and when to use each
- Professional Efficiency: You know command-line shortcuts and techniques used by professional developers