diff --git a/basic-commands.md b/basic-commands.md index 19e1fd7..afc8b2b 100644 --- a/basic-commands.md +++ b/basic-commands.md @@ -85,4 +85,13 @@ Essential commands used daily by DevOps and Cloud Engineers for secure remote se | :--- | :--- | :--- | | `sudo apt update && sudo apt upgrade -y` | Update package lists and upgrade all installed packages | Patching server vulnerabilities right after launching an instance. | | `sudo apt install -y docker.io` | Install a package automatically without confirmation prompts | Used inside CI/CD provisioning scripts for silent automation. | -| `sudo apt autoremove -y` | Remove unused packages and leftover dependencies | Cleaning up disk space on staging or production servers. | \ No newline at end of file +| `sudo apt autoremove -y` | Remove unused packages and leftover dependencies | Cleaning up disk space on staging or production servers. | + +## 🔎 8. Log Inspection & Troubleshooting + +| Command | Description | DevOps Real-Life Use Case | +| :--- | :--- | :--- | +| `journalctl -u docker.service -n 50` | View the last 50 log lines of a specific systemd service | Debugging container runtime errors when Docker crashes. | +| `journalctl -xe` | Show system logs trailing with extension details on failure | Finding root causes when `systemctl start` fails. | +| `tail -f /var/log/nginx/access.log` | Stream and monitor log files in real-time | Tracking live user traffic or identifying active DDOS attacks. | +| `grep -ri "fatal" /var/log/` | Search for a specific string inside all files recursively | Scanning heavy log directories for hidden application errors. | \ No newline at end of file