, , ,

Top 50 Linux Commands for Troubleshooting Linux Server

Posted by

Effective troubleshooting is essential in the field of Linux server management for upholding reliability, maximising efficiency, and guaranteeing security. Having a solid understanding of fundamental command-line tools can enable system administrators to quickly identify and fix problems. This is a thorough guide to the top 50 Linux commands that are essential for troubleshooting that any server administrator should know.

System Monitoring and Performance

  1. top: Real-time overview of system processes, CPU, and memory usage.

2. htop: Interactive process viewer with detailed system resource usage.


3. vmstat: Report virtual memory statistics.

vmstat 1

4. iostat: Report CPU and I/O statistics.

iostat -x 1

5. netstat: Display network connections, routing tables, interface statistics.

netstat -an

6. df: Report file system disk space usage.

df -h

7. du: Estimate file space usage.

du -sh /path/to/directory

8. fdisk: Partition table manipulator.

sudo fdisk -l

9. fsck: File system consistency check and repair.

sudo fsck /dev/sda1

Network Troubleshooting

10. ping: Test a network connection to a host.

ping google.com

11. traceroute: Print the route packets take to a network host.

traceroute google.com

12. tcpdump: Capture and analyze network packets.

sudo tcpdump -i eth0 -nn -s0 -v -w /tmp/capture.pcap

13. ss: Utility to investigate sockets.

ss -tuln

Process Management

14. ps: Report a snapshot of current processes.

ps aux | grep nginx

15. kill: Send a signal to a process.

kill -9 PID

16. pgrep: List processes based on name.

pgrep nginx

System Logs and Monitoring

17. journalctl: Query the systemd journal.

journalctl -xe

18. dmesg: Print or control the kernel ring buffer.

dmesg | tail

19. tail: Output the last part of files.

tail -f /var/log/syslog

Security and Access Control

  1. iptables: Administration tool for IPv4 packet filtering and NAT.
sudo iptables -L

21. firewalld: Firewall daemon with D-Bus interface.

sudo firewall-cmd --list-all

22. sshd: OpenSSH daemon configuration.

systemctl status sshd

System Maintenance and Configuration

  1. systemctl: Control the systemd system and service manager.
systemctl status apache2

24. sysctl: Configure kernel parameters at runtime.

sysctl: Configure kernel parameters at runtime.

25. lsof: List open files and processes.

lsof -i :80

Package Management

26. apt: Package management utility for Debian-based systems.

sudo apt update && sudo apt upgrade

27. yum: Package management utility for RPM-based systems.

sudo yum update

User and Group Management

28. useradd: Create a new user or update default new user information.

sudo useradd -m username

29. usermod: Modify a user account.

sudo usermod -aG sudo username

30. groupadd: Create a new group.

sudo groupadd newgroup

Backup and Restore

31. tar: Archive utility.

tar -cvzf archive.tar.gz /path/to/directory

32. rsync: Remote file and directory synchronization.

rsync -avz /local/path user@remote:/remote/path

System Performance Tuning

33. nice: Run a program with modified scheduling priority.

nice -n 19 command

34. renice: Alter priority of running processes.

renice +10 PID

Text Processing and Searching

35. grep: Print lines matching a pattern.

grep "error" /var/log/syslog

36. awk: Pattern scanning and processing language.

awk '{print $1}' /var/log/auth.log

37. sed: Stream editor for filtering and transforming text.

sed 's/old/new/g' file.txt

File and Directory Operations

38.mkdir: Make directories.

mkdir /path/to/directory

39.rm: Remove files or directories.

rm -rf /path/to/file

40. cp: Copy files and directories.

cp file.txt /path/to/destination

System Information

41. uname: Print system information.

uname -a

42. hostname: Print or set the system’s hostname.


Package Installation and Management

43. apt-get: APT package handling utility (legacy).

sudo apt-get install package_name

44. dpkg: Debian package manager.

dpkg -i package.deb

Process Control

45. killall: Kill processes by name.

killall -9 process_name

46. pstree: Display a tree of processes.


Network Administration

47. ifconfig: Configure a network interface.

ifconfig eth0 up

48. route: Show/manipulate the IP routing table.

route -n

File Permissions

49. chmod: Change file mode bits.

chmod 755 file.txt

50. chown: Change file owner and group.

chown user:group file.txt
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x