dos2unix

Convert Windows line endings

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

Converts CRLF to LF (and unix2dos does the reverse). Fixes “bad interpreter: ^M” errors in scripts.

Common flags
FlagMeaning
-nWrite to a new file
-kKeep timestamps
Examples
dos2unix script.shFix a script in place · explain & risk-check →
dos2unix -n in.txt out.txtConvert to a new file · explain & risk-check →
Related
file sed
Open the full explainer →More in Text Processing

Reference text is hand-written and may be incomplete — check man dos2unix for your version. Test destructive commands on a non-production system first.