Home > English, Tech Crunch > HOWTO Convert carriage returns between UNIX and DOS on Debian

HOWTO Convert carriage returns between UNIX and DOS on Debian

This article was first written in February 2005 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/203).

The convert carriage returns between UNIX- and DOS-kind of CR, use the tools dos2unix and unix2dos from the sysutils package.

Usage is really simple:

$ dos2unix filename


$ unix2dos filename

where filename is the name of the file to convert.

To convert a hierarchy of files starting from current directory:

$ find . -type f -exec dos2unix {} \;

For more information see the manpages.

  1. March 16, 2010 at 8:46 pm

    The following tools are availiable in package “tofrodos” in Debian Lenny, with the following package description:

    “Converts DOS Unix text files, alias tofromdos

    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.

    Tofrodos comprises one program, “fromdos” alias “todos”, which converts text files to and from these formats. Use “fromdos” to convert DOS text files to the Unix format, and “todos” to convert Unix text files to the DOS format.

    This functionality is also available via the dos2unix/unix2dos symlinks.”

    Source: http://packages.debian.org/lenny/tofrodos


    • ywarnier
      March 16, 2010 at 9:38 pm

      Thanks Joner

  2. FtpDaemon
    May 28, 2012 at 6:07 pm

    that helped, 10x.

  1. July 20, 2008 at 8:37 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: