Listen to this Post
2025-02-17
1. How to Check Disk Space Usage
Use `df -h` to view disk usage by mounted filesystems. For directory-level details, run du -sh /path/to/directory. Clean up old logs, unused packages, or large files with tools like `ncdu` for interactive analysis.
2. Service Fails to Start
Check status with systemctl status service-name. View logs via journalctl -u service-name --since "10 minutes ago". Ensure dependencies are installed and configuration files (e.g., /etc/service-name/config.conf) are correct.
3. Network Connectivity Issues
- Test connectivity: `ping 8.8.8.8` (Google DNS).
- Check routes: `ip route` or
traceroute google.com. - Verify DNS: `dig google.com` or
nslookup google.com. - Inspect interfaces: `ip a` or
ifconfig. Restart networking with `systemctl restart NetworkManager` (ornetworkd).
4. “Permission Denied” Errors
- Check permissions:
ls -l /path/to/file. - Modify permissions: `chmod 755 file` or
chown user:group file. - If SELinux/AppArmor blocks access, check logs (
/var/log/audit/audit.log) or temporarily disable withsetenforce 0.
5. Terminating Unresponsive Processes
- Find PID: `ps aux | grep process-name` or
top. - Kill process: `kill -9 PID` or
pkill process-name. - Force-kill all instances:
killall -9 process-name.
6. System Fails to Boot
- Boot into recovery mode (GRUB menu) and check logs (
/var/log/boot.logorjournalctl -b). - Repair filesystems:
fsck /dev/sdX. - Reinstall bootloader (GRUB):
grub-install /dev/sdX.
- “No Space Left on Device” Despite Free Space
– Check inode usage: df -i.
– Delete small, numerous files (e.g., temporary files) to free inodes.
8. DNS Resolution Failures
- Verify DNS config:
cat /etc/resolv.conf. - Test DNS server:
dig @8.8.8.8 google.com. - Restart DNS resolver:
systemctl restart systemd-resolved.
9. High CPU/Memory Usage
- Identify resource hogs:
top,htop, orvmstat 2. - Kill problematic processes or optimize applications. Check for memory leaks with
free -h.
10. SSH Connection Refused
- Ensure SSH service runs:
systemctl status sshd. - Check firewall rules: `ufw status` or
iptables -L. - Verify SSH port (default: 22) is open and accessible.
11. Filesystem Corruption
- Unmount the disk:
umount /dev/sdX. - Run `fsck /dev/sdX` to repair. Backup critical data first. For root FS, boot from a live USB.
12. Cron Jobs Not Executing
- Check cron logs:
grep CRON /var/log/syslog. - Ensure the cron service is running:
systemctl status cron. - Validate syntax and user permissions in `/etc/crontab` or user crontabs (
crontab -e).
13. Time Synchronization Issues
- Check NTP status: `timedatectl` or
ntpq -p. - Sync manually: `ntpdate pool.ntp.org` or restart
chronyd/systemd-timesyncd.
What Undercode Say
Linux troubleshooting is a critical skill for IT professionals and system administrators. The commands and techniques outlined above provide a robust foundation for diagnosing and resolving common issues in Linux environments. From disk space management to network troubleshooting, these tools ensure system stability and performance.
For disk-related issues, commands like df, du, and `ncdu` are indispensable. When dealing with service failures, `systemctl` and `journalctl` offer deep insights into system behavior. Network issues can be resolved using ping, ip, and dig, while permission problems often require `chmod` and chown.
Process management commands like ps, kill, and `pkill` help maintain system responsiveness, while `fsck` and `grub-install` are lifesavers for boot and filesystem issues. For cron jobs, always verify logs and service status. Time synchronization, often overlooked, can be managed with `timedatectl` and ntpdate.
In conclusion, mastering these commands not only enhances troubleshooting efficiency but also deepens your understanding of Linux internals. For further reading, consider exploring the official documentation for tools like systemd, GRUB, and iptables.
Useful Resources:
By integrating these commands into your daily workflow, you can ensure a seamless and efficient Linux experience.
References:
Hackers Feeds, Undercode AI


