An open API service indexing awesome lists of open source software.

https://github.com/nikoo-asadnejad/linux-commands-cheat-sheet

A collection of common Linux commands for system navigation, file management, networking, and more.
https://github.com/nikoo-asadnejad/linux-commands-cheat-sheet

command-line linux linux-cheating linux-cheatsheet linux-command linux-commands linux-kernel linux-shell linuxcheatsheet linuxcommand linuxcommands lpic lpic-1 lpic-2 lpic-2-study lpic1 lpic101 lpic2

Last synced: 4 months ago
JSON representation

A collection of common Linux commands for system navigation, file management, networking, and more.

Awesome Lists containing this project

README

        

# Linux-Commands-Cheat-Sheet

A collection of common Linux commands for system navigation, file management, networking, and more.

## Table of Contents
1. [Basic Commands](#basic-commands)
2. [Operators](#operators)
3. [File and Directory Management](#file-and-directory-management)
4. [File Permissions](#file-permissions)
5. [Screen](#screen)
6. [Shutdown and Sleep](#shutdown_and_sleep)
7. [User Management](#user-management)
8. [Package Management](#package-management)
9. [Cron Jobs and Scheduling](#cron-jobs-and-scheduling)
10. [Process Management](#process-management)
11. [System Monitoring](#system-monitoring)
12. [Systemd Management](systemd-management)
13. [Networking](#networking)
14. [SSH Management](#ssh-management)
15. [Mail Management](mail-management)
16. [Kernel and Modules Management](#kernel-and-modules-management)
17. [Boot, Bootloader (GRUB), and EFI Firmware](#boot-bootloader-grub-and-efi-firmware)

---

## Basic Commands

| Command | Description |
|--------------------|-------------------------------------|
| `pwd` | Print the current working directory |
| `ls` | List files in the directory |
| `cd ` | Change directory |
| `whoami` | Display current user |
| `echo ` | Print text to terminal |
| `history` | Show command history |

---

### System Information

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `uname -a` | Display detailed system information (kernel, hostname, etc.) |
| `uname -r` | Show the kernel version |
| `hostname` | Show or set the system hostname |
| `hostnamectl` | Display or set the system's hostname and related settings |
| `uptime` | Show how long the system has been running and system load |
| `whoami` | Display the current user |
| `id` | Show the current user’s ID and group information |
| `who` | Show who is currently logged into the system |
| `w` | Display who is logged in and what they are doing |
| `date` | Show or set the system date and time |
| `cal` | Display a calendar for the current month |
| `df -h` | Show disk space usage in human-readable format |
| `du -h ` | Display the disk usage of files and directories in human-readable format |
| `du -sh ` | Display the total size of a directory |
| `top` | Display real-time system resource usage and processes |
| `free -h` | Show memory usage in human-readable format |
| `lscpu` | Display CPU architecture information |
| `lsblk` | List information about block devices (disks, partitions) |
| `dmesg` | Display messages from the kernel ring buffer |
| `lsusb` | List information about USB devices |
| `lspci` | List information about PCI devices |
| `uptime` | Display the system’s uptime and load averages |
| `last` | Show the last logins of users |
| `uname -m` | Show the machine hardware name (e.g., x86_64) |

---

## Operators

| Operator | Description |
|-----------------|-----------------------------------------------------------------------------|
| `|` (Pipe) | Pass the output of one command as input to another command (`ls | grep txt`) |
| `>` | Redirect output to a file, overwriting the file if it exists (`echo "Hello" > file.txt`) |
| `>>` | Redirect output to a file, appending if the file exists (`echo "Hello" >> file.txt`) |
| `<` | Redirect input from a file to a command (`sort < file.txt`) |
| `2>` | Redirect error output to a file (`command 2> error.log`) |
| `2>&1` | Redirect error output to standard output (`command > file.txt 2>&1`) |
| `&` | Run a command in the background (`command &`) |
| `&&` | Run the next command only if the previous command succeeds (`command1 && command2`) |
| `||` | Run the next command only if the previous command fails (`command1 || command2`) |
| `;` | Run multiple commands in sequence (`command1; command2; command3`) |
| `$(command)` | Command substitution: use the output of a command as an argument (`echo $(date)`) |
| `&>` | Redirect both standard output and error output to a file (`command &> output.log`) |

___

## File and Directory Management

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ls` | List files and directories in the current directory |
| `ls -l` | List files and directories with detailed information |
| `ls -a` | List all files, including hidden files |
| `cd ` | Change to a specific directory |
| `cd ..` | Move up one directory level |
| `pwd` | Display the current working directory |
| `mkdir ` | Create a new directory |
| `rmdir ` | Remove an empty directory |
| `rm ` | Delete a file |
| `rm -r ` | Remove a directory and its contents recursively |
| `rm -rf ` | Forcefully remove a directory and its contents |
| `cp ` | Copy files or directories |
| `cp -r ` | Copy directories recursively |
| `mv ` | Move or rename files and directories |
| `touch ` | Create an empty file or update the timestamp of an existing file |
| `ln -s ` | Create a symbolic link (soft link) |
| `ln ` | Create a hard link |
| `cat ` | Display the contents of a file |
| `less ` | View the contents of a file page by page |
| `more ` | View the contents of a file page by page (older than `less`) |
| `head ` | Display the first 10 lines of a file |
| `tail ` | Display the last 10 lines of a file |
| `tail -f ` | Display the contents of a file in real-time (follow the file as it grows) |
| `find -name ` | Search for a file or directory by name |
| `find -type d -name ` | Find directories matching a specific name |
| `find -type f -name ` | Find files matching a specific name |
| `grep "" ` | Search for a specific pattern in a file |
| `grep -r "" ` | Search for a pattern recursively in a directory |

---

## File Permissions

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ls -l` | List files and show their permissions, owner, and group |
| `chmod ` | Change the permissions of a file or directory |
| `chmod 644 ` | Set read/write for owner and read-only for group and others |
| `chmod 755 ` | Set read/write/execute for owner, read/execute for group and others |
| `chown : ` | Change the owner and group of a file or directory |
| `chown ` | Change the owner of a file |
| `chgrp ` | Change the group of a file |

---

## Screen

| Command | Description |
|------------------------------|-----------------------------------------------------|
| `screen` | Start a new screen session |
| `screen -S ` | Start a new screen session with a custom name |
| `screen -ls` | List all active screen sessions |
| `screen -r ` | Reattach to a detached screen session |
| `Ctrl + a + d` | Detach from the current screen session |
| `screen -X -S quit` | Force quit a screen session |
| `Ctrl + a + k` | Kill the current screen |
| `screen -x ` | Attach to a running session shared by multiple users|
| `Ctrl + a + n` | Switch to the next window in the screen session |
| `Ctrl + a + p` | Switch to the previous window in the screen session |
| `Ctrl + a + c` | Create a new window in the current screen session |
| `Ctrl + a + "` | List all windows in the current session |

___

## Shutdown and Sleep

| Command | Description |
|------------------------------|-------------------------------------------------------|
| `shutdown now` | Shut down the system immediately |
| `shutdown -h now` | Halt the system immediately |
| `shutdown -r now` | Restart the system immediately |
| `shutdown -h +

___

## User Management

| Command | Description |
|----------------------------------------------|-------------------------------------------------------------------|
| `adduser ` | Create a new user with home directory and default shell |
| `useradd ` | Create a new user (minimal setup, no home directory by default) |
| `userdel ` | Delete a user account |
| `userdel -r ` | Delete a user account and their home directory |
| `passwd ` | Change the password for a user |
| `chage -l ` | Display password aging information for a user |
| `usermod -aG ` | Add a user to a group |
| `groups ` | List groups a user is part of |
| `id ` | Show user ID (UID), group ID (GID), and other group memberships |
| `deluser ` | Remove a user from the system |
| `deluser ` | Remove a user from a specific group |
| `sudo ` | Execute a command as the superuser |
| `su ` | Switch to another user account (requires that user's password) |
| `who` | Show who is logged in |
| `whoami` | Display the current logged-in user |
| `last` | Show last logins of users |
| `w` | Display who is logged in and what they are doing |
| `finger ` | Display detailed information about a user |
| `getent passwd` | Display all users in the system |
| `vipw` | Safely edit the `/etc/passwd` file (user accounts) |
| `visudo` | Safely edit the `/etc/sudoers` file |
| `chown : ` | Change ownership of a file |
| `chmod ` | Change file permissions |

---

### Group Management

| Command | Description |
|----------------------------------------------|-------------------------------------------------------------------|
| `groupadd ` | Create a new group |
| `groupdel ` | Delete a group |
| `gpasswd -a ` | Add a user to a group (alternative to `usermod -aG`) |
| `gpasswd -d ` | Remove a user from a group |
| `newgrp ` | Switch to a new group for the current session |
| `groups ` | Display the groups a user belongs to |
| `getent group ` | Show group entry in `/etc/group` |

---

### Account and Session Management

| Command | Description |
|----------------------------------------------|-------------------------------------------------------------------|
| `chage -E ` | Set an account expiration date for a user |
| `chage -M ` | Set maximum number of days a password remains valid |
| `chage -m ` | Set minimum number of days before a password can be changed |
| `chage -I ` | Set the number of days after a password expires before an account is disabled |
| `faillog -u ` | Show login failure statistics for a user |
| `faillog -r ` | Reset failed login count for a user |
| `lastlog` | Show the last login of all users |
| `pkill -u ` | Terminate all processes owned by a user |
| `passwd -l ` | Lock a user account (disallow login) |
| `passwd -u ` | Unlock a user account |
| `nologin` | Prevent a user from logging in by setting their shell to `/sbin/nologin` |

---

## Package Management

### Debian/Ubuntu

| Command | Description |
|------------------------------|---------------------------------------------|
| `apt-get update` | Update package list |
| `apt-get upgrade` | Upgrade all installed packages |
| `apt-get install ` | Install a package |
| `apt-get remove ` | Remove a package |

### Red Hat/CentOS

| Command | Description |
|------------------------------|---------------------------------------------|
| `yum update` | Update package list |
| `yum install ` | Install a package |
| `yum remove ` | Remove a package |

---

## Cron Jobs and Scheduling

### Managing Cron Jobs

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `crontab -e` | Edit the current user's crontab file |
| `crontab -l` | List the current user's cron jobs |
| `crontab -r` | Remove the current user's crontab file |
| `sudo crontab -e -u ` | Edit the crontab for a specified user |
| `sudo crontab -l -u ` | List the crontab for a specified user |
| `sudo crontab -r -u ` | Remove the crontab for a specified user |

---

### Cron Job Syntax
Cron jobs are defined using the following syntax:

* * * * * command_to_run

#### Example Cron Job Entries

| Entry | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `0 5 * * * /path/to/script.sh` | Run a script every day at 5:00 AM |
| `*/15 * * * * /path/to/backup.sh` | Run a backup script every 15 minutes |
| `0 0 1 * * /path/to/report.sh` | Run a report script at midnight on the first day of every month |
| `30 2 * * 1 /path/to/cleanup.sh` | Run a cleanup script every Monday at 2:30 AM |

---

### System-Wide Cron Jobs

System-wide cron jobs are configured in `/etc/crontab` and can also be found in the `/etc/cron.d/` directory.

### Scheduling with `at`

The `at` command is used to schedule one-time tasks.

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `at 10:00` | Schedule a command to run at 10:00 AM (prompt for the command) |
| `echo "command_to_run" | at 10:00` | Schedule a command to run at 10:00 AM |
| `atq` | List scheduled jobs for the current user |
| `atrm ` | Remove a scheduled job by its job number |

---

## Process Management:

### Viewing Processes

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ps aux` | List all running processes in detail |
| `ps -ef` | List processes with full-format output |
| `top` | Show real-time system resource usage (CPU, memory, processes) |
| `htop` | Enhanced interactive process viewer (`htop` needs to be installed separately)|
| `pgrep ` | Find the PID(s) of a process by name |
| `pidof ` | Find the PID of a running process |
| `pstree` | Display processes in a tree-like format |

### Managing Processes

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `kill ` | Terminate a process by PID |
| `kill -9 ` | Forcefully kill a process |
| `killall ` | Kill all processes by name |
| `pkill ` | Kill processes by name (supports regular expressions) |
| `bg` | Resume a suspended job in the background |
| `fg` | Bring a background job to the foreground |
| `jobs` | List all background jobs in the current shell |
| `nice -n ` | Start a process with a specified priority (lower value = higher priority) |
| `renice ` | Change the priority of a running process |

### Monitoring Processes

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `top` | Display real-time information about running processes and resource usage |
| `htop` | Interactive version of `top` (install separately with `sudo apt-get install htop`) |
| `uptime` | Show how long the system has been running |
| `free -m` | Display system memory usage in megabytes |
| `vmstat` | Report virtual memory statistics |
| `lsof` | List open files by processes |
| `strace -p ` | Trace system calls made by a process |
| `watch ` | Execute a command repeatedly and monitor its output in real-time |

### Signals

Linux processes can be sent various signals to control their behavior.

| Signal | Number | Description |
|-----------|---------|---------------------------------------|
| `SIGHUP` | 1 | Hangup, reload configuration |
| `SIGINT` | 2 | Interrupt from keyboard (Ctrl + C) |
| `SIGKILL` | 9 | Kill signal, cannot be ignored |
| `SIGTERM` | 15 | Termination signal |
| `SIGSTOP` | 19 | Stop process (cannot be ignored) |
| `SIGCONT` | 18 | Continue a stopped process |

---

### Background & Foreground Process Management

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `command &` | Run a command in the background |
| `bg` | Resume a suspended job in the background |
| `fg` | Bring a background job to the foreground |
| `jobs` | List current jobs and their statuses |
| `nohup &` | Run a command immune to hangups, in the background |
| `disown ` | Remove a job from the job table, leaving it running |

---

### Process Ownership and Security

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ps -u ` | List all processes belonging to a user |
| `sudo -u ` | Run a command as a different user |
| `chown : ` | Change ownership of files or directories |
| `chmod ` | Modify permissions for a file or directory |
| `setfacl -m u::rwx ` | Set file access control lists (ACLs) for a user on a file |
| `getfacl ` | View ACL permissions of a file |

---

### Monitoring CPU and Memory Usage by Process

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `top` | Display processes sorted by CPU usage |
| `htop` | Interactive real-time process viewer |
| `ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu` | List processes sorted by CPU usage |
| `ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem` | List processes sorted by memory usage |

---

## Systemd Management

**systemd** is the system and service manager for Linux operating systems. It is responsible for managing services, processes, and various units.

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `systemctl` | Main command for managing systemd services and units |
| `systemctl status ` | Check the status of a service |
| `systemctl start ` | Start a service |
| `systemctl stop ` | Stop a running service |
| `systemctl restart ` | Restart a service |
| `systemctl reload ` | Reload the configuration of a service without restarting it |
| `systemctl enable ` | Enable a service to start on boot |
| `systemctl disable ` | Disable a service from starting on boot |
| `systemctl is-enabled ` | Check if a service is enabled to start at boot |
| `systemctl daemon-reload` | Reload systemd manager configuration files after changes |
| `systemctl list-units --type=service` | List all systemd services |
| `systemctl list-units --failed` | List failed services |
| `journalctl -u ` | View logs for a specific service |
| `journalctl -xe` | View systemd logs with more details on errors |
| `systemctl mask ` | Completely disable a service, even if another service tries to start it |
| `systemctl unmask ` | Re-enable a masked service |
| `systemctl show ` | Show detailed properties of a service |
| `systemctl cat ` | View the unit file for a service |
| `systemctl isolate ` | Switch to a specific system target (e.g., `multi-user.target`, `rescue.target`) |

### Systemd Unit Types

Systemd manages various types of units, not just services.

| Unit Type | Description |
|----------------------|----------------------------------------------------------|
| `.service` | A system service (e.g., web servers, databases) |
| `.socket` | A socket for inter-process communication |
| `.device` | A device unit exposed by the Linux kernel |
| `.mount` | A file system mount point |
| `.automount` | A mount point that is automatically mounted on access |
| `.swap` | A swap device or file |
| `.target` | A group of systemd units (e.g., `multi-user.target`) |
| `.timer` | A scheduling unit similar to cron jobs |

### Common Targets

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `systemctl get-default` | Show the current default target (e.g., multi-user, graphical) |
| `systemctl set-default ` | Set the default target (e.g., `multi-user.target`, `graphical.target`) |
| `systemctl isolate ` | Switch the system to the specified target (e.g., `rescue.target`) |

---

## Networking

### Network Interface Management

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ip addr` | Show all network interfaces and their IP addresses |
| `ip -a` | Show all network interfaces and their IP addresses |
| `ip addr show ` | Display information about a specific network interface |
| `ip link set up` | Bring a network interface up |
| `ip link set down` | Bring a network interface down |
| `ifconfig` | Display or configure network interface (older command, use `ip` for new systems) |
| `ifconfig ` | Show details about a specific network interface |
| `ifdown ` | Take a network interface down (Debian-based systems) |
| `ifup ` | Bring a network interface up (Debian-based systems) |
| `ethtool ` | Display or change Ethernet device settings |
| `ip route` | Display or manipulate the routing table |
| `ip route add via ` | Add a new route to the routing table |
| `ip route del ` | Remove a route from the routing table |
| `hostname` | Show or set the system’s hostname |
| `hostname -I` | Display all IP addresses of the host |
| `nmcli dev show ` | Display the connection status of a specific network interface (NetworkManager) |
| `nmcli device status` | Show status of all network interfaces (NetworkManager) |
| `nmcli connection show` | Display saved network connections (NetworkManager) |
| `nmcli connection up ` | Bring up a specific network connection (NetworkManager) |
| `nmcli connection down ` | Bring down a specific network connection (NetworkManager) |
| `sudo nmcli connection reload` | Reload connection |
| `nmtui` | Text-based user interface for managing network connections |
| `sudo systemctl restart NetworkManager` | Apply configs |
| `sudo nmtui` | Ui for managing network in RHel |
| `cat /etc/sysconfig/network-scripts/ifcfg-eth160` | ip configs in redhat |

---

### DNS Management

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `dig ` | Query DNS information for a domain |
| `dig +short ` | Get the short output (e.g., only the IP address) |
| `dig @ ` | Query a specific DNS server for domain resolution |
| `nslookup ` | Query DNS information for a domain |
| `host ` | Perform DNS lookup and reverse lookup |
| `systemd-resolve --status` | Show DNS resolution status (systemd-resolved) |
| `resolvectl query ` | Query DNS using systemd-resolved |
| `cat /etc/resolv.conf` | Display DNS server configuration |

---

### Network Troubleshooting

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ping ` | Check connectivity to a host |
| `ping -c ` | Send a specific number of ICMP echo requests to a host |
| `ping6 ` | Send an ICMP echo request to a host using IPv6 |
| `traceroute ` | Trace the path packets take to reach a host |
| `tracepath ` | Similar to traceroute, but does not require superuser privileges |
| `mtr ` | Combines `ping` and `traceroute` to provide continuous network analysis |
| `netstat -tuln` | Show listening ports and services |
| `ss -tuln` | Show listening sockets (more modern than `netstat`) |
| `nc -zv ` | Check if a specific port is open on a host (TCP/UDP connection test) |
| `nc -l ` | Open a port and listen for incoming connections |
| `telnet ` | Check TCP connectivity to a host and port |
| `curl ` | Perform a basic HTTP request and display the response |
| `curl -I ` | Display HTTP headers for a URL |
| `curl -O ` | Download a file from a URL |
| `wget ` | Download files from the web using HTTP, HTTPS, or FTP |
| `arp -a` | Display the system's ARP table (shows MAC to IP mappings) |
| `tcpdump` | Capture and analyze network traffic |
| `tcpdump -i ` | Capture packets on a specific network interface |
| `tcpdump -nn -X port ` | Capture packets on a port and display the packet contents in hexadecimal |

---

### Firewall Management (iptables and firewalld)

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `iptables -L` | List all firewall rules |
| `iptables -A -p --dport -j ` | Add a rule to a chain (e.g., ACCEPT, DROP) |
| `iptables -D ` | Delete a specific rule from a chain |
| `iptables -F` | Flush (delete) all firewall rules |
| `firewall-cmd --list-all` | List all active firewalld rules (CentOS, Fedora) |
| `firewall-cmd --add-service=` | Temporarily allow a service through the firewall |
| `firewall-cmd --permanent --add-service=` | Permanently allow a service through the firewall |
| `firewall-cmd --remove-service=` | Remove a service from the firewall |
| `ufw status` | Display the status of UFW (Uncomplicated Firewall) (Ubuntu) |
| `ufw enable` | Enable UFW |
| `ufw disable` | Disable UFW |
| `ufw allow /` | Allow traffic on a port (e.g., `ufw allow 22/tcp`) |
| `ufw deny /` | Deny traffic on a port |

---

### Network File Transfer

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `scp @:` | Securely copy files to a remote host |
| `scp @: ` | Securely copy files from a remote host |
| `rsync -avz @:` | Synchronize files between local and remote hosts |
| `rsync -avz @: ` | Synchronize files from remote to local |
| `sftp @` | Start a secure file transfer session |
| `ftp ` | Start an FTP session (unencrypted) |

---

### SSH and Remote Connections

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ssh @` | Connect to a remote host via SSH |
| `ssh -i @` | Connect to a remote host using a specific private key |
| `ssh -L :: @` | Create an SSH tunnel with port forwarding |
| `ssh-copy-id @` | Copy local SSH key to a remote host to enable passwordless login |
| `scp @: ` | Securely copy files between local and remote hosts |
| `sftp @` | Securely transfer files to/from a remote host using SFTP |
| `tmux` | Start a terminal multiplexer session (maintain SSH sessions) |
| `screen` | Start a screen session (maintain SSH sessions) |

## System Monitoring

This section provides commands for monitoring system performance, processes, CPU, memory, disk I/O, and network activity.

### General System Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `top` | Real-time view of CPU and memory usage by processes |
| `htop` | Enhanced, interactive version of `top` with additional features (may require installation) |
| `vmstat` | Report virtual memory statistics, including processes, memory, paging, block I/O, and CPU activity |
| `glances` | Comprehensive system monitoring tool (requires installation) |
| `uptime` | Show how long the system has been running and system load |
| `watch ` | Run a command repeatedly at regular intervals and display the output live |

---

### CPU Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `mpstat` | Display CPU usage per core (from `sysstat` package) |
| `sar` | Collect, report, and save system activity information (including CPU, memory, I/O, etc.) |
| `lscpu` | Display CPU architecture information (model, cores, speed) |
| `cat /proc/cpuinfo` | Display detailed CPU information |
| `iostat` | CPU and I/O statistics, part of the `sysstat` package |

---

### Memory Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `free -h` | Display memory usage in human-readable format (total, used, free, swap) |
| `vmstat -s` | Memory and swap statistics in a detailed format |
| `cat /proc/meminfo` | View detailed memory statistics |
| `watch free -h` | Monitor memory usage in real-time |
| `dmidecode --type memory` | Display detailed information about installed memory (requires root) |

---

### Disk Usage and I/O Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `df -h` | Display disk space usage in human-readable format |
| `du -sh ` | Display the total size of a directory in human-readable format |
| `iostat` | Show disk I/O and CPU usage statistics (from `sysstat` package) |
| `iotop` | Display real-time disk I/O usage by processes (requires installation) |
| `dstat` | Comprehensive resource statistics (including disk I/O) |
| `lsblk` | List block devices, partitions, and file systems |
| `blkid` | Display block device attributes such as UUIDs and file system types |
| `df -i` | Show inode usage for file systems |
| `du -ah ` | Show disk usage for all files and directories |
| `hdparm -t /dev/sda` | Test read speed of a disk (may require installation) |

---

### Process Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ps aux` | List all running processes with detailed information |
| `pgrep ` | Search for a running process by name |
| `pidof ` | Find the process ID (PID) of a running process |
| `pstree` | Show processes in a tree-like format |
| `kill ` | Send a signal to terminate a process using its PID |
| `killall ` | Terminate all processes matching a specific name |
| `pkill ` | Send a signal to processes based on name and other attributes |
| `renice ` | Change the priority of a running process |
| `strace -p ` | Trace system calls and signals for a specific process |
| `lsof` | List open files by processes |
| `lsof -i :` | List processes using a specific network port |
| `nice -n ` | Start a command with a specified priority |

---

### Network Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `netstat -tuln` | Show listening ports and their associated services |
| `ss -tuln` | More modern version of `netstat`, shows listening ports |
| `iftop` | Display real-time network bandwidth usage (requires installation) |
| `nload` | Show incoming and outgoing network traffic (requires installation) |
| `tcpdump -i ` | Capture and display network packets on a specific interface |
| `iptraf-ng` | Real-time network traffic monitoring (requires installation) |
| `ping ` | Test network connectivity by sending ICMP echo requests |
| `traceroute ` | Trace the path packets take to reach a network host |
| `ss -s` | Show detailed socket statistics |
| `arp -a` | Display the system's ARP table (address resolution protocol) |
| `dig ` | Query DNS servers for information about a hostname |
| `host ` | Perform DNS lookup for a domain or IP address |
| `nslookup ` | Query DNS to resolve a hostname to an IP address |
| `mtr ` | Network diagnostic tool combining `ping` and `traceroute` (requires installation) |

---

### Miscellaneous System Monitoring

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `uptime` | Show how long the system has been running and the current load average |
| `last` | Show the last logins of users on the system |
| `sar` | Collect and display system activity statistics (CPU, memory, I/O, network) |
| `dstat` | Tool for generating detailed performance and resource statistics |
| `vmstat` | Report information about processes, memory, paging, and I/O |
| `iostat -x` | Show extended I/O statistics, including disk utilization |
| `tload` | Show a graphical representation of system load in the terminal |
| `uptime` | Display system uptime and load averages |
| `w` | Show who is logged in and what they are doing |
| `who` | Show who is logged in to the system |

## SSH Management

SSH (Secure Shell) is a protocol used for securely accessing remote machines over a network. This section covers commands for managing SSH connections, keys, and configuration.

### Basic SSH Commands

| Command | Description |
|----------------------------------------------|-----------------------------------------------------------------------------|
| `ssh @` | Connect to a remote host as a specified user |
| `ssh -p