🗂️ CATEGORIES:
- ✅ System Monitoring & Info
- 🔐 Security & Access
- 📁 Log Management
- 📡 Network & Firewall
- ⚙️ Automation & Backup
- 📦 Package & Service Management
- 🧠 Custom Scripts / Misc
✅ 1. SYSTEM MONITORING & INFO
Command | Description |
---|---|
uptime | Shows how long the system has been running and load average. |
who | Shows who is logged in. |
w | Displays who is logged in and what they are doing. |
top | Real-time view of CPU/memory usage. |
df -h | Shows disk usage in human-readable format. |
free -m | Shows memory usage in MB. |
hostname -I | Displays local IP address. |
ps aux | Lists all running processes. |
lsof | Lists open files, often used to trace processes using a file. |
🔐 2. SECURITY & ACCESS
Command | Description |
---|---|
last | Lists login history. |
lastb | Lists failed login attempts (uses /var/log/btmp ). |
whoami | Shows current logged-in user. |
id | Shows user ID and groups. |
sudo ufw status | Displays current UFW firewall rules. |
sudo ufw allow 5000/tcp | Allows incoming traffic on port 5000. |
sudo ufw allow from YOUR.IP.ADDRESS to any port 5000 | Allows only your IP to access port 5000. |
sudo ufw deny from IP_ADDRESS | Blocks specific IP address. |
sudo fail2ban-client status | Checks fail2ban status. |
journalctl -u ssh | View logs for SSH service. |
📁 3. LOG MANAGEMENT
Command | Description |
---|---|
cat /var/log/auth.log | View authentication-related logs. |
cat /var/log/syslog | General system activity logs. |
zcat /var/log/syslog.1.gz | View compressed logs (rotated). |
logrotate | Tool for automatic log rotation. |
tar -czf logs-YYYY-MM-DD.tar.gz /var/log | Archive logs manually. |
sha256sum logs-*.tar.gz | Create checksum to verify archive integrity. |
📡 4. NETWORK & FIREWALL
Command | Description |
---|---|
curl http://127.0.0.1:5000/ | Test local Flask server access. |
curl http://checkip.amazonaws.com | Get public IP address from AWS. |
netstat -tuln | Show listening ports. |
ss -tuln | Modern alternative to netstat. |
sudo ufw enable/disable | Turn UFW firewall on or off. |
iptables -L | View current iptables rules. |
⚙️ 5. AUTOMATION & BACKUP
Command | Description |
---|---|
crontab -e | Edit crontab for scheduling tasks. |
mkdir -p /mnt/secure-logs | Create archive directory. |
tar -czf /mnt/secure-logs/logs-YYYY-MM-DD.tar.gz /var/log | Archive logs with compression. |
bash check-secure.sh | Run a custom security audit script. |
python3 app.py | Run your Flask dashboard. |
📦 6. PACKAGE & SERVICE MANAGEMENT
Command | Description |
---|---|
pip install flask | Install Flask (Python package). |
sudo apt update && sudo apt upgrade | Update system packages. |
systemctl status ssh | Check SSH service status. |
systemctl restart ssh | Restart SSH service. |
sudo systemctl enable fail2ban | Enable fail2ban at boot. |
sudo apt install fail2ban | Install fail2ban. |
🧠 7. CUSTOM / OTHER
Command | Description |
---|---|
ls -l | List files with details. |
chmod +x script.sh | Make script executable. |
./script.sh | Run a shell script in the current directory. |
echo "hello" | Print text to terminal. |