Essential Command Line Tools Every Windows/Linux System Administrator Must Master


2 views

As system administrators, we rely on fundamental tools that become extensions of our workflow. Here's a breakdown of essential utilities with practical examples:

For Linux sysadmins, mastering terminal multiplexers is non-negotiable:


# GNU Screen basic usage
screen -S session_name  # Create new session
Ctrl+a d                # Detach from session
screen -r               # Reattach to session

# tmux example (modern alternative)
tmux new -s mysession   # Create session
tmux attach -t mysession # Reattach

SSH is just the beginning of remote administration:


# SSH key management
ssh-keygen -t ed25519 -f ~/.ssh/admin_key
ssh-copy-id -i ~/.ssh/admin_key.pub user@server

# Windows equivalent (PowerShell)
New-Item -ItemType Directory -Path ~/.ssh
ssh-keygen -t ed25519 -f ~/.ssh/admin_key

Go beyond basic top/htop monitoring:


# Linux process analysis
ps aux --sort=-%mem | head -n 10  # Top memory processes
iotop -oPa                         # Disk I/O monitoring

# Windows equivalents
Get-Process | Sort-Object WS -Descending | Select -First 10
Get-Counter '\LogicalDisk(*)\% Disk Time'

Package managers differ between systems but follow similar principles:


# Debian/Ubuntu
apt update && apt upgrade
apt-cache search package_name

# RHEL/CentOS
dnf update
dnf provides */filename

# Windows (PowerShell)
Find-Package -Name *chrome*
Install-Package -Name 7zip

Effective log parsing saves hours of troubleshooting:


# Linux log analysis
journalctl -u nginx --since "1 hour ago"
grep -Ei 'error|fail' /var/log/syslog | tail -n 50

# Windows Event Log
Get-WinEvent -FilterHashtable @{
    LogName='System','Application'
    Level=1,2,3
    StartTime=(Get-Date).AddHours(-1)
}

Even without full automation, these help manage multiple systems:


# Ansible ad-hoc commands
ansible all -m ping
ansible webservers -a "systemctl restart nginx"

# PowerShell DSC example
Configuration WebServerSetup {
    Node "localhost" {
        WindowsFeature IIS {
            Ensure = "Present"
            Name = "Web-Server"
        }
    }
}

Essential network diagnostic tools for both platforms:


# Linux network tools
ss -tulnp  # Modern netstat replacement
tcpdump -i eth0 port 80 -w capture.pcap

# Windows equivalents
Get-NetTCPConnection -State Established
netsh trace start capture=yes report=yes

These work similarly across Windows and Linux:


# curl (available on both platforms)
curl -I https://example.com
curl -X POST -d @data.json https://api.example.com

# rsync (Windows through WSL or cygwin)
rsync -avz /source user@remote:/destination

As professional sysadmins, we live in terminals and management consoles. Here's my curated list of must-know tools after 10+ years maintaining both Windows and Linux environments:

# Process monitoring
top → htop → bpytop (modern alternative)
# Example: Show tree view of processes
htop -t

Text Processing Ninja Tools:

# Find and replace across multiple files
find /var/log -name "*.log" -exec sed -i 's/old/new/g' {} +
# Advanced log filtering
journalctl --since "2 hours ago" | grep -i error | cut -d' ' -f5- | sort | uniq -c
# PowerShell equivalents for Linux tools
Get-Process | Where CPU -gt 90 | Format-Table -AutoSize
# Advanced system info
Get-CimInstance Win32_OperatingSystem | Select LastBootUpTime

Must-have RSAT Tools:

  • Active Directory Administrative Center
  • DNS Manager
  • Group Policy Management Console

SSH Productivity:

# Create persistent sessions
screen -S maintenance
tmux new -s deployment
# SSH config for multiple hosts
Host prod-web
    HostName 192.168.1.100
    User admin
    IdentityFile ~/.ssh/prod_key

Network Diagnostics:

# Windows
Test-NetConnection -ComputerName db-server -Port 5432
# Linux
nc -zv db-server 5432
tcpdump -i eth0 port 80 -w capture.pcap

Example Ansible playbook snippet:

-
  name: Ensure Apache is installed
  hosts: web_servers
  tasks:
    -
      name: Install Apache
      package:
        name: httpd
        state: present
    -
      name: Start and enable service
      service:
        name: httpd
        state: started
        enabled: yes

Equivalent PowerShell DSC configuration:

Configuration WebServerSetup {
    Node "localhost" {
        WindowsFeature IIS {
            Ensure = "Present"
            Name   = "Web-Server"
        }
    }
}

Quick Nagios check example:

define command {
    command_name    check_disk
    command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}

For modern systems, Prometheus exporter snippet:

from prometheus_client import start_http_server, Gauge
import psutil

disk_usage = Gauge('disk_usage_percent', 'Disk usage percent by mountpoint')

def collect_metrics():
    for part in psutil.disk_partitions():
        usage = psutil.disk_usage(part.mountpoint)
        disk_usage.labels(part.mountpoint).set(usage.percent)

if __name__ == '__main__':
    start_http_server(8000)
    while True:
        collect_metrics()
        time.sleep(60)

Even for config files, Git is essential:

# Initialize repo for /etc
cd /etc
git init
git add .
git commit -m "Initial server config snapshot"
# Create branch for changes
git checkout -b nginx-config-update