December 8

Linux: dos2unix and unix2dos

The big question is why would you want to use unix2dos in this world of modern and advanced software?

In general the answer is you probably do not, but in some cases you might.

One key area it could quickly help is if you are working in a Linux environment that does not have X Windows.

If you open a document file that was created in Windows there is a fair chance that it look something like this:

cat test.txt
This is a test file^M
That contains the annoying mark up language^M
That works well inWindows, but not so much in Linux^M

User the command dos2unix test.txt will get you the following results:
cat test.txt
This is a test file
That contains the annoying mark up language
That works well inWindows, but not so much in Linux

unix2dos will add the carriage returns back.

Not a huge deal, but can help in a pinch sometimes.


Copyright 2021. All rights reserved.

Posted December 8, 2011 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B