Session and utilities

The dos2unix command

Converts a file from Windows line endings (CRLF) to Unix (LF). Fixes the classic ^M error.

Syntax

dos2unix archivo...

Copy-ready examples

$ printf 'a\n' > d.txt && dos2unix d.txtConvert to Unix format

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It modifies the file in place: if you need it unchanged, make a copy first.

Related commands

FAQ

What is the ^M error?

A Windows newline that shows as ^M on Linux and breaks scripts.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course