Video summary
20% of Linux Commands You'll Use 80% of the Time (Real-World Example)
Main summary
Key takeaways
Main ideas, concepts, and lessons
- Use Linux commands to turn the terminal into a troubleshooting superpower, especially for real-world scenarios like debugging production issues.
- Practice safely and consistently without setting up a full Linux machine:
- Use Docker Desktop with a pre-built custom Docker image that already includes the needed Linux environment/tools.
Core Linux workflow for diagnosing an outage
- Confirm you’re in the expected Linux environment.
- Navigate to the application’s log directory.
- Inspect logs, filter for relevant errors, and save results for later.
- Identify the failure pattern (e.g., database connection refused).
- Locate database configuration files across the filesystem.
- Compare current vs. backup configs to find the erroneous setting.
- Verify whether the expected service/port is actually reachable.
- Fix configuration by editing the file.
- Adjust permissions if the config is read-only.
- Re-test after changes and exit the container.
Methodology / step-by-step instructions (detailed)
A) Set up a Linux practice environment using Docker
-
Install Docker Desktop
- Download Docker Desktop for Windows or Mac.
- Start Docker Desktop so it runs in the background.
-
Start a Linux container from a custom image
- Open your system terminal (Windows Terminal / macOS Terminal).
- Run the command to pull the creator’s custom Linux Docker image (using the link from the video description).
- Run the image as a container using the command that starts an interactive Linux terminal inside it.
-
No prior Docker knowledge required
- Just run the provided image commands.
B) Validate the Linux environment
- Use:
uname
- Purpose:
- Confirm the OS/environment type (Linux).
C) Diagnose a production issue by inspecting application logs
-
Check your current directory
- Command:
pwd - Lesson: know where you are in the filesystem first.
- Command:
-
Navigate to the application log folder
- Command:
cd <path> - Example path used:
/var/sl/log/sl/application(as shown in subtitles)
- Command:
-
List files in the log directory
- Command:
ls
- Command:
-
View extended details (permissions, sizes, etc.)
- Command:
ls -l
- Command:
-
Read log file contents
- Command:
cat <filename> - Lesson: inspect raw errors directly when you see failures.
- Command:
-
Filter logs to specific error lines
- Use pipes to connect commands (output from one command becomes input to the next).
- Example filter:
grep database(matches lines containing the word/phrase)
- Lesson: focus on relevant errors using filtering.
-
Save filtered results to a new file
- Redirect output into a file:
> database errors.txt
- Validate it exists and isn’t empty:
ls -lcat database errors.txt
- Redirect output into a file:
D) Copy saved troubleshooting artifacts for persistence
- Copy using:
cp <source> <destination>
- Example goal:
- Backup
database errors.txtto/rootwith a shorter name (e.g.,DB errors.txt).
- Backup
E) Count occurrences of a specific failure
-
Filter for a multi-word phrase (requires quotes)
grep "connection refused"on the saved error file.
-
Count matching lines
- Pipe into:
wc -l
- Pipe into:
- Lesson:
- Use filtering + counting to understand frequency and retries.
F) Find database configuration files across the entire system
- Locate likely config files using:
find ...
- Approach shown:
- Search for files matching a pattern/substring (related to configs containing
dokon/ “docon” in subtitles). - Search across the whole filesystem:
- Start from
/(root of filesystem tree).
- Start from
- Search for files matching a pattern/substring (related to configs containing
- After getting candidate files:
- Filter again using
grepto find the right ones (e.g., those containing “DB”).
- Filter again using
- Then:
- Enter the suspicious application folder if needed to inspect configs.
G) Compare configuration and identify the wrong port
- Compare two files using:
diff <file1> <file2>
- Goal:
- Determine what changed between an active config file and a backup.
- Lesson:
- A port mismatch causes failure:
- The application tries connecting to 5433 instead of PostgreSQL default 5432.
- A port mismatch causes failure:
H) Verify whether the correct database port is reachable
- Use
curlto probe the service/port:curl -I http://localhost:5432
- Purpose:
- Check if PostgreSQL responds on port 5432 (headers only, not full content).
- Outcome:
- Confirms the database is running on the expected port, so the application config is wrong.
I) Fix the configuration using an editor (Vim)
- Open the config file in Vim:
vim <configfile>
- Handle Vim modes:
- Press
ito enter insert/edit mode.
- Press
- If prompted about read-only:
- File permissions are likely preventing edits.
- Exit without saving:
Escthen:q!
- Save after changes:
Escthen:wq
J) Resolve read-only / permission issues by changing file permissions
- Inspect permissions with:
ls -l
-
Key concept:
- Permission bits govern read/write/execute for:
- owner, group, others
- Permission bits govern read/write/execute for:
-
Change permissions using:
chmod <mode> <file>
-
Mode examples discussed:
444= read-only for all666= read/write for all777= full read/write/execute for all0= no permissions
-
Goal in the demo:
- Modify permissions so the config file becomes editable, edit it, then revert it back to read-only.
K) Restart the application (implied)
- After updating the corrected port in the config:
- Restart so the application uses the new configuration.
- Expected result:
- The application connects to PostgreSQL on the correct port.
L) Exit the container
- Command:
exit
- Outcome:
- Returns to the host OS terminal.
- Verification:
- Run
unameagain to confirm you’re back on the host OS (Darwin-based system in subtitles).
- Run
Speakers or sources featured (as identifiable from subtitles)
- Video creator / instructor (unnamed speaker; demonstrates commands and explains steps)
- Docker image creator (referenced as “my custom Docker image” with a link to it)
- PostgreSQL (referenced as the database service/technology being tested)
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.