Practical Linux Skills
Linux Scripting Fundamentals
Bash scripting is a powerful skill for system automation and task management. Understanding script structure and syntax enables efficient system administration.
graph TD
A[Bash Scripting] --> B[Variables]
A --> C[Conditional Logic]
A --> D[Loop Structures]
A --> E[Function Definition]
Basic Bash Script Example
#!/bin/bash
## System health monitoring script
check_system_health() {
echo "CPU Usage:"
top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "%"}'
echo "Memory Usage:"
free -h | grep Mem | awk '{print $3 " / " $2}'
echo "Disk Space:"
df -h / | awk '/\// {print $5" used"}'
}
check_system_health
Package Management with APT
Command |
Function |
Example |
apt update |
Refresh package lists |
sudo apt update |
apt upgrade |
Update installed packages |
sudo apt upgrade |
apt install |
Install new packages |
sudo apt install nginx |
apt remove |
Remove packages |
sudo apt remove package-name |
Network Configuration Utilities
Linux provides robust networking tools for system administrators:
## Network diagnostic commands
ip addr show ## Display network interfaces
ping google.com ## Test network connectivity
netstat -tuln ## List active network connections
System Logging and Monitoring
## System log inspection
journalctl -xe ## View recent system logs
tail /var/log/syslog ## Monitor system messages
systemctl status nginx ## Check service status
These practical skills demonstrate Linux's flexibility in system administration, networking, and automation tasks.