dos2unix
file managementLinux/Unix
The dos2unix command is one of the most frequently used commands in Linux/Unix-like operating systems. dos2unix Convert text file line endings from DOS/Windows format to Unix format
Quick Reference
Command Name:
dos2unix
Category:
file management
Platform:
Linux/Unix
Basic Usage:
dos2unix [options] [arguments]
Common Use Cases
Syntax
dos2unix [options] [file ...]
Options
Option | Description |
---|---|
-ascii |
Convert only line breaks (default) |
-iso |
Conversion between DOS and ISO-8859-1 character set |
-1252 |
Use Windows code page 1252 (Western European) |
-b, --keep-bom |
Keep Byte Order Mark |
-f, --force |
Force conversion of binary files |
-h, --help |
Display help information |
-k, --keepdate |
Keep output file date |
-L, --license |
Display program license |
-n, --newfile input output |
New file mode, convert input to output |
-o, --oldfile file |
Old file mode, convert file in place (default) |
-q, --quiet |
Quiet mode, suppress all warnings |
-v, --verbose |
Verbose operation |
Examples
How to Use These Examples
The examples below show common ways to use the dos2unix
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
dos2unix file.txt