# Linux-Troubleshooting Scenarios

Listen to this Post

Here are some key points for troubleshooting common issues in Linux systems:

1. Server Connectivity Issues:

  • Ping the server by Hostname and IP Address:
    ping example.com 
    ping 192.168.1.1 
    
  • Check service availability with telnet command:
    telnet example.com 22 
    
  • Verify service status, firewall settings, logs, and configuration:
    systemctl status sshd 
    sudo ufw status 
    journalctl -xe 
    

2. Disk Space Full Issue:

  • Detect system performance degradation:
    df -h 
    
  • Identify large files/directories:
    du -sh * | sort -h 
    
  • Check disk health:
    sudo badblocks -v /dev/sda 
    

3. Filesystem Corruption:

  • Check logs for errors:
    cat /var/log/syslog | grep error 
    
  • Run fsck to repair filesystem:
    sudo fsck /dev/sda1 
    

4. Fstab File Issues:

  • Verify fstab entries:
    cat /etc/fstab 
    sudo mount -a 
    

5. Memory Issues:

  • Monitor memory usage:
    free -m 
    top 
    htop 
    
  • Kill high-memory processes:
    kill -9 $(pidof memory-hog-process) 
    

6. Swap Space Management:

  • Create and enable swap file:
    sudo fallocate -l 1G /swapfile 
    sudo chmod 600 /swapfile 
    sudo mkswap /swapfile 
    sudo swapon /swapfile 
    
  • Make swap persistent:
    echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab 
    

You Should Know:

  • Check open ports:
    sudo netstat -tuln 
    sudo ss -tuln 
    
  • Analyze disk I/O:
    sudo iotop 
    
  • Find and kill zombie processes:
    ps aux | grep 'Z' 
    
  • Test network speed:
    speedtest-cli 
    
  • Check CPU load:
    uptime 
    mpstat 
    

What Undercode Say:

Linux troubleshooting requires a systematic approach—verify connectivity, disk, memory, and logs before making changes. Always back up critical data before running repairs like fsck. Automation (cron, scripts) helps prevent recurring issues.

Expected Output:


<h1>Example output of `df -h` </h1>

Filesystem Size Used Avail Use% Mounted on 
/dev/sda1 50G 45G 2.0G 96% / 

<h1>Example output of `free -m` </h1>

total used free shared buff/cache available 
Mem: 7982 4201 1023 123 2757 3456 
Swap: 2047 512 1535 

References:

Reported By: Shamseer Siddiqui – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image