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¶
- Basics and Navigation - Start here
- File and directory navigation
- Basic file operations (ls, cd, cp, mv, rm)
-
Viewing file contents (cat, less, head, tail)
- Understanding Linux permissions
- chmod, chown, chgrp
- User and group management
-
Special permissions (SUID, SGID, Sticky Bit)
- APT (Debian/Ubuntu)
- YUM/DNF (RHEL/CentOS/Fedora)
- Alternative package managers (Snap, Flatpak)
Intermediate Level¶
- Systemctl Services
- Managing system services
- Creating custom services
- Systemd timers
-
Service troubleshooting
- Viewing processes (ps, top, htop)
- Killing processes (kill, killall, pkill)
- Process priority (nice, renice)
-
Background jobs
- CPU, memory, disk monitoring
- System logs (journalctl, syslog)
- Performance tools (vmstat, iostat, sar)
- Resource troubleshooting
Advanced Level¶
- File Management
- Compression and archiving (tar, gzip, zip)
- Searching files (find, locate)
- Searching within files (grep)
-
Text processing (awk, sed, cut)
- Network interfaces and configuration
- Network diagnostics (ping, traceroute, netstat)
- SSH and remote access
-
Firewall management
- Bash scripting fundamentals
- Variables, loops, conditionals
- Functions and arrays
- 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¶
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¶
- Check CPU load:
toporhtop - Check memory:
free -h - Check disk I/O:
iostat -x 1 - Check disk space:
df -h - Review logs:
journalctl -p err
Service Won't Start¶
- Check status:
systemctl status service - View logs:
journalctl -u service -n 50 - Check configuration: Verify config files
- Check permissions: Ensure proper file ownership
- Check dependencies: Verify required services are running
Network Issues¶
- Check interface:
ip link show - Check IP address:
ip addr show - Ping gateway:
ping $(ip route | grep default | awk '{print $3}') - Test DNS:
ping google.com - Check firewall:
sudo ufw statusorsudo firewall-cmd --list-all
Disk Full¶
- Check usage:
df -h - Find large files:
find / -type f -size +100M 2>/dev/null - Find large directories:
du -h / | sort -rh | head -20 - Clean package cache:
apt cleanoryum clean all - 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 monitoringvmstat- Virtual memory statisticsiostat- I/O statisticssar- System activity reporterdstat- Versatile resource statistics
Network Tools¶
ping- Test connectivitytraceroute- Trace network pathss/netstat- Socket statisticstcpdump- Packet analyzeriftop- Bandwidth monitoring
File Tools¶
find- Search for filesgrep- Search within filestar- Archive filesrsync- Sync filesdiff- Compare files
Text Processing¶
awk- Pattern scanning and processingsed- Stream editorcut- Extract columnssort- Sort linesuniq- 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¶
- Navigate to /var/log and list all files
- Create a directory structure: ~/projects/web/frontend
- Find all .conf files in /etc
- View the last 50 lines of /var/log/syslog
- Change permissions of a file to 644
Intermediate¶
- Create a script to backup a directory
- Find all files larger than 100MB
- Monitor CPU usage of a specific process
- Set up a custom systemd service
- Configure SSH key authentication
Advanced¶
- Write a script to monitor disk usage and send alerts
- Create a log rotation script
- Set up automated backups with compression
- Build a system health check script
- Implement a service monitoring and restart script
Navigation¶
Related Topics¶
- DevOps Core README - Main documentation index
- Operating System Concepts - OS fundamentals
- Networking - Network concepts
- Shell Scripting Examples - Advanced scripts
Quick Links¶
- Basics | Permissions | Packages
- Services | Processes | Monitoring
- Files | Networking | Scripting
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