To-ing and fro-ing in Linux-land

August 24th, 2007 | Categories: Linux | Tags:

I work in a mixed operating system environment: Linux, Windows, Solaris, Mac-OS X… you name it, we’ve got it and I am expected to be able to at least get by in all of them. This helps make life interesting but occasionally weird things can happen.

Some time ago I was helping a student who was using a commercial quantum chemistry package called Gaussian. She had created some input scripts on her windows machine and needed to transfer them over to a linux Beowulf cluster in order to crunch the numbers. They worked on her windows machine but as soon as we did the transfer to the linux machine, the program complained about the input file – saying that there were syntax errors.

The solution to her woes was very simple – a linux command called dos2unix. Quoting from the dos2unix manpage – “DOS text files traditionally have CR/LF (carriage return/line feed) pairs as their new line delimiters while Unix text files traditionally have LFs (line feeds) to terminate each line.”

Obviously the linux version of the Gaussian code did not like all of those carriage returns so all we needed to do was type

dos2unix filename.inp

on the linux machine and we were good to go. Just recently I found myself needing this command again but it was not installed on my Ubuntu machine and the obvious ‘apt-get install dos2unix‘ did not work. It turns out that the package you need is tofrodos so run ‘apt-get install tofrodos‘ and you should be good to too and fro as much as you please.

No comments yet.