dos2unix on Ubuntu and Debian
DOS text files traditionally have a carriage return and line feed character as newline character or symbol – mostly for historic reasons i think. Unix and Linux on the other hand have a line feed character as newline character in text files – and Macs have yet another “standard”.
From time to time I need to convert from one text file “standard” to another.
Red Hat-based Linux distributions are normally distributed with a small tool called dos2unix, which is able to do the conversion job very easy, but Debian-based Linux distributions like Debian itself and Ubuntu do not include the dos2unix tool by default.
The dos2unix tool i available in the Debian / Ubuntu package called tofrodos. To install the packages just type:
aptitude install tofrodos
Once you have the tofrodos package installed you are able to use the dos2unix command from the command line, like this:
dos2unix dosfile.txt
After running the command all the historic and crappy windows newlines are gone.
Related posts:
- Recursive convert dos newlines to unix ones with dos2unix
- Howto: Create your own Debian or Ubuntu package repository
- Howto: Install Ruby and Rails on Debian or Ubuntu
- Ubuntu Howto: Install Oracle
- Bash shortcuts tips and tricks
- Howto install Sun Java on Debian Sarge
- How to mount bin / cue image files in Linux
- Howto Install Oracle on Debian
- Howto: Write Debian Package Descriptions
- Howto: Install Windows Vista Fonts in Ubuntu
Popular Related Items »
Incoming search terms
- dos2unix ubuntu
- ubuntu dos2unix
- dos2unix debian
- debian dos2unix
- ubuntu install dos2unix
- dos2unix ubuntu package
- install dos2unix ubuntu
- ubuntu dos to unix
- dos2unix for ubuntu
- ubuntu dos2unix install
- dostounix ubuntu
- debian lenny dos2unix
- dos2unix debian lenny
- dos2unix install ubuntu
- dos2unix ubuntu install
- dos2unix on ubuntu
- dos2unix debian package
- ubuntu dos 2 unix
- ubuntu dos2unix package
- ubuntu 9 04 dos2unix
- dos2unix package
- ubuntu dostounix
- debian dos to unix
- dos2unix install
- dos to unix ubuntu
- dos2unix command ubuntu
- dos2unix in ubuntu
- dos 2 unix ubuntu
- dos to unix debian
- dos2unix
- dos2unix command in ubuntu
- Install dos2unix in ubuntu
- how to install dos2unix in ubuntu
- lenny dos2unix
- debian dos2unix package
- dos2unix command debian
- install dos2unix
- unbuntu dos2unix
- debian dostounix
- debian package dos2unix
- dos2unix ubuntu 9 04
- dostounix debian
- ubuntu 9 10 dos2unix
- ubuntu package dos2unix
- debian dos2unix lenny

Pages tagged "linux" said,
April 30, 2008 @ 15:49
[...] tagged linuxOwn a WordPress blog? Make monetization easier with the WP Affiliate Pro plugin. dos2unix on Ubuntu and Debian saved by 5 others zilchnerd bookmarked on 04/30/08 | [...]
Quentin said,
July 28, 2010 @ 19:43
I have a script that calls “dos2unix” that died because it was missing.
Evidently, on my Ubuntu 10.4 (lucid) release, “dos2unix” and “unix2dos” are no longer in the tofrodos package, instead you have “fromdos” and “todos”.
Since it appears in the man page that the utility detects what to do from it’s own name and still respects the “dos2unix” and “unix2dos” names, you could keep the old behaviour for your stodgy old scripts with these lines:
sudo ln -sf /usr/bin/fromdos /usr/local/bin/dos2unix
sudo ln -sf /usr/bin/todos /usr/local/bin/unix2dos
But I elected to upgrade my scripts.
– Q