Skip to content

Linux Fundamentals

Overview

This directory contains comprehensive guides for Linux system administration and DevOps fundamentals. Each topic is organized into focused modules covering essential commands, concepts, and practical examples.


Learning Path

Beginner Level

  1. Basics and Navigation - Start here
  2. File and directory navigation
  3. Basic file operations (ls, cd, cp, mv, rm)
  4. Viewing file contents (cat, less, head, tail)

  5. Permissions

  6. Understanding Linux permissions
  7. chmod, chown, chgrp
  8. User and group management
  9. Special permissions (SUID, SGID, Sticky Bit)

  10. Package Management

  11. APT (Debian/Ubuntu)
  12. YUM/DNF (RHEL/CentOS/Fedora)
  13. Alternative package managers (Snap, Flatpak)

Intermediate Level

  1. Systemctl Services
  2. Managing system services
  3. Creating custom services
  4. Systemd timers
  5. Service troubleshooting

  6. Process Management

  7. Viewing processes (ps, top, htop)
  8. Killing processes (kill, killall, pkill)
  9. Process priority (nice, renice)
  10. Background jobs

  11. System Monitoring

  12. CPU, memory, disk monitoring
  13. System logs (journalctl, syslog)
  14. Performance tools (vmstat, iostat, sar)
  15. Resource troubleshooting

Advanced Level

  1. File Management
  2. Compression and archiving (tar, gzip, zip)
  3. Searching files (find, locate)
  4. Searching within files (grep)
  5. Text processing (awk, sed, cut)

  6. Networking

  7. Network interfaces and configuration
  8. Network diagnostics (ping, traceroute, netstat)
  9. SSH and remote access
  10. Firewall management

  11. Shell Scripting

  12. Bash scripting fundamentals
  13. Variables, loops, conditionals
  14. Functions and arrays
  15. Practical automation examples

Quick Reference

Essential Commands by Category

File Operations

ls -la                    # List files with details
cd /path                  # Change directory
cp source dest            # Copy file
mv old new                # Move/rename file
rm file                   # Remove file
mkdir dir                 # Create directory

File Viewing

cat file                  # Display entire file
less file                 # Page through file
head -n 20 file           # First 20 lines
tail -f file              # Follow file updates

Permissions

chmod 755 file            # Change permissions
chown user:group file     # Change owner
ls -l file                # View permissions

Process Management

ps aux                    # List all processes
top                       # Real-time process monitor
kill PID                  # Terminate process
killall name              # Kill by name

System Monitoring

free -h                   # Memory usage
df -h                     # Disk usage
du -sh dir                # Directory size
uptime                    # System load

Networking

ip addr                   # Show IP addresses
ping host                 # Test connectivity
ss -tuln                  # Show listening ports
ssh user@host             # Remote login

Package Management

# Debian/Ubuntu
apt update                # Update package list
apt install package       # Install package
apt remove package        # Remove package

# RHEL/CentOS
yum install package       # Install package
yum update                # Update packages

Services

systemctl start service   # Start service
systemctl stop service    # Stop service
systemctl status service  # Check status
systemctl enable service  # Enable at boot

Common Use Cases

System Administration

  • User Management: Create users, set permissions, manage groups
  • Service Management: Start/stop services, configure auto-start
  • Log Analysis: Search logs, troubleshoot errors
  • Disk Management: Monitor space, clean up old files
  • Security: Configure firewall, manage SSH access

DevOps Tasks

  • Automation: Write scripts for repetitive tasks
  • Monitoring: Set up system health checks
  • Deployment: Manage application services
  • Troubleshooting: Diagnose performance issues
  • Backup: Automate backup procedures

Development

  • Environment Setup: Install development tools
  • Process Debugging: Monitor application processes
  • Log Monitoring: Track application logs
  • Network Testing: Test connectivity and ports
  • File Management: Organize and search code files

Troubleshooting Guide

System is Slow

  1. Check CPU load: top or htop
  2. Check memory: free -h
  3. Check disk I/O: iostat -x 1
  4. Check disk space: df -h
  5. Review logs: journalctl -p err

Service Won't Start

  1. Check status: systemctl status service
  2. View logs: journalctl -u service -n 50
  3. Check configuration: Verify config files
  4. Check permissions: Ensure proper file ownership
  5. Check dependencies: Verify required services are running

Network Issues

  1. Check interface: ip link show
  2. Check IP address: ip addr show
  3. Ping gateway: ping $(ip route | grep default | awk '{print $3}')
  4. Test DNS: ping google.com
  5. Check firewall: sudo ufw status or sudo firewall-cmd --list-all

Disk Full

  1. Check usage: df -h
  2. Find large files: find / -type f -size +100M 2>/dev/null
  3. Find large directories: du -h / | sort -rh | head -20
  4. Clean package cache: apt clean or yum clean all
  5. Remove old logs: find /var/log -name "*.log" -mtime +30 -delete

Best Practices

Security

  • Use SSH keys instead of passwords
  • Keep system and packages updated
  • Use sudo instead of root login
  • Configure firewall properly
  • Regular security audits

Performance

  • Monitor system resources regularly
  • Set up automated alerts
  • Clean up old files and logs
  • Optimize service configurations
  • Use appropriate process priorities

Maintenance

  • Regular backups
  • Log rotation
  • Package updates
  • Security patches
  • Documentation of changes

Scripting

  • Always test scripts before production
  • Use version control for scripts
  • Add error handling
  • Document script purpose and usage
  • Follow naming conventions

Tools and Utilities

System Monitoring

  • top / htop - Process monitoring
  • vmstat - Virtual memory statistics
  • iostat - I/O statistics
  • sar - System activity reporter
  • dstat - Versatile resource statistics

Network Tools

  • ping - Test connectivity
  • traceroute - Trace network path
  • ss / netstat - Socket statistics
  • tcpdump - Packet analyzer
  • iftop - Bandwidth monitoring

File Tools

  • find - Search for files
  • grep - Search within files
  • tar - Archive files
  • rsync - Sync files
  • diff - Compare files

Text Processing

  • awk - Pattern scanning and processing
  • sed - Stream editor
  • cut - Extract columns
  • sort - Sort lines
  • uniq - Remove duplicates

Additional Resources

Man Pages

man command               # View manual for command
man -k keyword            # Search man pages
info command              # Alternative documentation

Help Commands

command --help            # Quick help
command -h                # Short help
type command              # Show command type
which command             # Show command location

Online Resources

  • Linux Documentation Project: https://tldp.org/
  • Arch Linux Wiki: https://wiki.archlinux.org/
  • Ubuntu Documentation: https://help.ubuntu.com/
  • Red Hat Documentation: https://access.redhat.com/documentation/

Practice Exercises

Beginner

  1. Navigate to /var/log and list all files
  2. Create a directory structure: ~/projects/web/frontend
  3. Find all .conf files in /etc
  4. View the last 50 lines of /var/log/syslog
  5. Change permissions of a file to 644

Intermediate

  1. Create a script to backup a directory
  2. Find all files larger than 100MB
  3. Monitor CPU usage of a specific process
  4. Set up a custom systemd service
  5. Configure SSH key authentication

Advanced

  1. Write a script to monitor disk usage and send alerts
  2. Create a log rotation script
  3. Set up automated backups with compression
  4. Build a system health check script
  5. Implement a service monitoring and restart script


Contributing

If you find errors or have suggestions for improvements: 1. Document the issue clearly 2. Provide examples if applicable 3. Suggest corrections or additions 4. Test commands before submitting


Last Updated: January 2026 Maintained by: DevOps Documentation Team