This tutorial covers the fundamental skills needed to get started in system administration. Learn about operating systems, user management, networking basics, system monitoring, and automation using shell scripts. Real-world examples and practice exercises are provided.
Step 1: Operating System Fundamentals
- Understand the role of an operating system
- Compare Linux, macOS and Windows for system administration
- Learn basic OS commands and navigation
- Practice with the command line interface
ls -l /etcPractice Exercise
Write commands to:
- Create a new directory called
scriptsin your home directory - Create a new empty file in
scriptscalledsys_info.sh - Change the file permissions of
sys_info.shto be executable
Show Solution
1. mkdir ~/scripts
2. touch ~/scripts/sys_info.sh
3. chmod +x ~/scripts/sys_info.shStep 2: User and Group Management
- Create, modify and delete user accounts
- Understand Linux file permissions and ownership
- Manage groups and group membership
- Set and modify file permissions
useradd -m johnPractice Exercise
Write commands to:
- Create a new user account named
mikewith default settings - Add
miketo the existing groupdevelopers - Copy your
scriptsdirectory to mike's home directory - Change ownership of mike's
scriptsdirectory to mike
Show Solution
1. sudo useradd -m mike
2. sudo usermod -a -G developers mike
3. sudo cp -r ~/scripts /home/mike
4. sudo chown -R mike:mike /home/mike/scriptsStep 3: Networking Basics
- Understand IP addresses, subnets, and ports
- Configure network interfaces
- Diagnose network connectivity issues
- Learn key networking commands
ip addr showPractice Exercise
Write commands to:
- Display your system's hostname
- Show IP address and subnet mask of your ethernet interface
- Ping google.com and show first 4 responses
- Trace the route packets take to reach www.linkedin.com
Show Solution
1. hostname
2. ip addr show eth0
3. ping -c 4 google.com
4. traceroute www.linkedin.comStep 4: System Monitoring Essentials
- Monitor CPU, memory and disk usage
- Check system logs for errors
- Set up basic performance monitoring
- Learn to use tools like top, df, and tail
top -cPractice Exercise
Write commands to:
- Display top 5 processes consuming the most memory
- Show current disk usage of your home directory
- Monitor system logs in real-time for error messages
- Save error messages from system logs to a file called
errors.login yourscriptsdirectory
Show Solution
1. ps aux --sort=-%mem | head -n 6
2. du -sh ~
3. sudo tail -f /var/log/syslog | grep --color -i error
4. sudo grep -i error /var/log/syslog > ~/scripts/errors.logStep 5: Automation with Shell Scripts
- Understand basic shell script syntax
- Learn concepts like variables, conditions, and loops
- Automate repetitive tasks with simple scripts
- Schedule scripts with cron
#!/bin/bash
echo "Hello, $USER"Practice Exercise
Write a shell script to:
- Print "System Info Report" followed by the current date and time
- Save the output of the
topcommand to a file calledtop_output.txtin the current directory - Append the disk usage of the
/directory to the same file on the next line - Print "Report generated!" when done
crontabShow Solution
#!/bin/bash
echo "System Info Report"
date
top -n 1 -b > top_output.txt
du -sh / >> top_output.txt
echo "Report generated!"
```
To schedule in crontab:
`0 8 * * * /path/to/script.sh`Sign in to take Cornell notes on this lesson — they save automatically and stay with your account.