Q: A user downloads a custom binary file `kubectl` into their `~/Downloads` folder. They type `kubectl` in the terminal, but get `command not found`. Why, and how do they fix it permanently?
The shell relies on the $PATH environment variable, which is an ordered list of directories (like /usr/bin or /usr/local/bin). When you t...
#Linux #Linux / SRE — Scenario-Based Interview Questions #L1 #SRE #Systems #Troubleshooting
🎙️ Candidate Opening & Architectural Context
""Never reboot a server blindly; always capture top process telemetry, lsof descriptors, and thread dumps first. The interviewer is testing: The `$PATH` environment variable.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
The shell relies on the $PATH environment variable, which is an ordered list of directories (like /usr/bin or /usr/local/bin). When you type a command, the system only searches those exact directories for the executable. It does not actively search ~/Downloads.
- Move the binary into an authorized path:
sudo mv ~/Downloads/kubectl /usr/local/bin/ - Permanently add the Downloads directory to their path by appending
export PATH=$PATH:~/Downloadsto their~/.bashrcor~/.zshrcprofile, so the shell learns to search there automatically.
2️⃣
Remediation & Permanent Safeguards
To fix it, they must either:
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Move the binary into an authorized path: sudo mv ~/Downloads/kubectl /usr/local/bin/."
⚡ 60-Second Elevator Pitch Talking Points
- Move the binary into an authorized path: sudo mv ~/Downloads/kubectl /usr/local/bin/
- Permanently add the Downloads directory to their path by appending export PATH=$PATH:~/Downloads ...
Advertisement