From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.


dos2unix is a tool to convert text files from DOS line endings (carriage return + line feed) to Unix line endings (line feed). It is also capable of conversion between UTF-16 to UTF-8. Invoking the unix2dos command can be used to convert from Unix to DOS. This tool comes in handy when sharing files between Windows and Linux machines.


root #emerge --ask app-text/dos2unix


To convert a file that has DOS line endings to Unix format:

user $dos2unix my_file.txt
dos2unix: converting file my_file.txt to Unix format...

To convert a file that has Unix line endings to DOS format:

user $unix2dos my_file.txt
unix2dos: converting file my_file.txt to DOS format...

External resources

  • man dos2unix