In the dynamic world of server administration, challenges are inevitable. Whether it’s performance issues, network glitches, or unexpected errors, a proficient system administrator should be well-versed in troubleshooting. we’ll explore the top 50 Linux commands specifically designed to help administrators diagnose and resolve problems, ensuring the seamless operation of their Linux servers.
- dmesg (Display Message):
- Prints kernel ring buffer messages, revealing information about hardware and system events.
- journalctl:
- Examines system logs and journal entries, providing insights into recent activities.
- top:
- Displays real-time system resource usage, aiding in identifying processes consuming excessive CPU or memory.
- htop:
- A more advanced alternative to top, offering an interactive, user-friendly process viewer.
- vmstat (Virtual Memory Statistics):
- Reports information about system memory, processes, and CPU activity.
- iostat (Input/Output Statistics):
- Monitors input/output (I/O) statistics for disks and partitions.
- free:
- Displays the amount of free and used memory in the system.
- sar (System Activity Reporter):
- Collects, reports, and saves system activity information.
- ps (Process Status):
- Lists information about active processes, aiding in process troubleshooting.
- lsof (List Open Files):
- Lists open files and the processes using them, useful for identifying file-related issues.
- netstat (Network Statistics):
- Displays network-related information, including active connections and listening ports.
- ss (Socket Statistics):
- Provides detailed socket statistics, offering a more modern alternative to netstat.
- ifconfig (Interface Configuration):
- Configures and displays network interface parameters.
- ping:
- Tests network connectivity by sending ICMP echo requests to a specified host.
- traceroute:
- Maps the route that packets take to reach a destination, aiding in network troubleshooting.
- tcpdump:
- Captures and analyzes network packets, helpful for diagnosing network issues.
- strace:
- Traces system calls and signals for a given process, aiding in debugging.
- ltrace:
- Captures library calls made by a program, useful for troubleshooting application issues.
- grep (Global Regular Expression Print):
- Searches for specific patterns in files or command output.
- find:
- Searches for files and directories based on specified criteria.
- awk:
- A versatile text processing tool for pattern scanning and text extraction.
- sed (Stream Editor):
- Edits and transforms text streams using regular expressions.
- tail:
- Displays the last few lines of a file, aiding in log file analysis.
- head:
- Displays the first few lines of a file.
- nano/vi (Text Editors):
- Basic text editors for viewing and editing files directly from the command line.
- df (Disk Free):
- Shows disk space usage, helping administrators manage storage efficiently.
- du (Disk Usage):
- Displays the size of directories, assisting in identifying space-consuming files.
- stat:
- Displays file or file system status, providing detailed information.
- uptime:
- Shows how long the system has been running and current system load.
- lsblk (List Block Devices):
- Lists information about block devices, including disk partitions and their mount points.
- mount:
- Displays mounted file systems, helping troubleshoot issues related to storage.
- journalctl -xe:
- Provides detailed logs, including error messages, for troubleshooting.
- systemctl:
- Manages system services and provides information about their status.
- lshw (List Hardware):
- Lists detailed information about hardware components.
- lscpu (List CPU Information):
- Displays information about the system’s CPU architecture.
- lsusb (List USB Devices):
- Lists USB devices connected to the system.
- lsmod (List Loaded Kernel Modules):
- Displays a list of loaded kernel modules.
- ip (Internet Protocol):
- Configures and displays network interface parameters.
- dstat:
- Combines features of vmstat, iostat, and netstat in a single tool for comprehensive system monitoring.
- mtr (My TraceRoute):
- Combines the functionality of ping and traceroute, providing real-time network diagnostics.
- apropos:
- Searches the manual page names and descriptions for troubleshooting commands.
- ldd (List Dynamic Dependencies):
- Lists dynamic dependencies for a given executable or shared library.
- ldconfig:
- Configures the dynamic linker runtime bindings.
- uname (Unix Name):
- Displays system information, including the kernel version and machine architecture.
- kill:
- Terminates a running process by sending a signal to its process ID.
- watch:
- Executes a command repeatedly, providing real-time updates.
- sync:
- Synchronizes file system changes to disk, ensuring data integrity.
- nohup:
- Runs a command immune to hangups, useful for long-running processes.
- atop:
- Monitors system resource utilization, providing detailed insights.
- shutdown:
- Initiates a system shutdown, ensuring a controlled and graceful exit.