Linux Survival Basics
Read-only, can be slowFind CRLF Lines in a Script
You need scoped evidence before line-ending conversion.
Command
grep -n $'\r' script.sh | head
Before you run this
System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.
When not to use it: Do not run broad conversions across a repository from this output alone.
Expected output
Line numbers containing carriage returns, or no output if none match.
System impact
Read-only, can be slow. Nothing changes. The command reads current state and prints diagnostic evidence.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use before converting a single script file.
When not to use it
Do not run broad conversions across a repository from this output alone.
Example run
Commands shown
These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.
grep -n $'\r' script.shgrep -n $'\r' script.sh | head
next steps
Related commands
Show Hidden CRLF in a Script Shebang
The hidden carriage return is often the whole bug.
head -1 script.sh | cat -v
Find the Exact Log Line Before You Scroll
The error was there. The useful part was knowing exactly where it was.
grep -inE 'error|failed|denied|timeout' /var/log/nginx/error.log
Count Failures by Test File
Turn noisy test logs into a ranked failure list.
grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
Find Errors Before Reading Every Log Line
The error was in the log. The problem was finding it without reading noise.
grep -iE 'error|failed|denied|timeout' /var/log/nginx/error.log | tail -40
Find Running Package Manager Processes
A package lock is usually a symptom, not the first thing to delete.
ps -ef | grep -E 'apt|dpkg|dnf|yum|pacman' | grep -v grep
next diagnostic step
Where to go from this command
- Bad interpreter CRLF hub Use to scope CRLF cleanup.
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.