Linux System Administration

Introduction

Linux system administration involves managing, maintaining, and securing Linux-based systems and networks.

Core Responsibilities

Essential Commands

System Information


# System info
uname -a         # System/kernel information
lsb_release -a   # Distribution information
df -h           # Disk usage
free -h         # Memory usage
top             # Process information
htop            # Interactive process viewer

# User Management
useradd         # Add new user
usermod         # Modify user
userdel         # Delete user
passwd          # Change password
id              # User/group info

# File Operations
ls -la          # List files with details
chmod           # Change permissions
chown           # Change ownership
find            # Search files
tar             # Archive files
        

System Management

Package Management

APT (Debian/Ubuntu):
  • apt update
  • apt upgrade
  • apt install
  • apt remove

Service Management

Systemd:
  • systemctl start
  • systemctl stop
  • systemctl enable
  • systemctl disable

Network Management

Commands:
  • ifconfig/ip
  • netstat/ss
  • ping
  • traceroute

Security Best Practices

File System Management

Directory Structure

File Permissions


# Permission Types
r (read)    = 4
w (write)   = 2
x (execute) = 1

# Common Permission Sets
chmod 755   # rwxr-xr-x
chmod 644   # rw-r--r--
chmod 700   # rwx------
            

Common Issues

Monitoring and Maintenance

Regular Tasks

Useful Scripts


#!/bin/bash
# System health check
echo "Disk Usage:"
df -h
echo -e "\nMemory Usage:"
free -h
echo -e "\nSystem Load:"
uptime
echo -e "\nActive Services:"
systemctl list-units --type=service --state=running