ASCII and Binary file for text file share

Mike Brodbelt m.brodbelt at
Wed Jul 5 11:09:17 GMT 2000

Julian.Tan at wrote:
> I have finally competed setting up the samba server and setup the share
> between NT and Samba server.
> However, when I open a unix text file in Windows NT using notepad, i see
> many funny characters and the text file is not in order (Just like when I
> ftp the unix text file out into NT in binary format) ...I think this has to
> be something to do with whether the file transfer is in Binary format or
> ASCII ... Is there a parameter to set for this ? I have checked the
> documents ... but couldn't find anything on this ...

This is a FAQ, but it brief, it's like this. Unix uses a single newline
character to end a line ("\n"), while DOS/Win/NT use a
carriage-return/newline pair ("\r\n"). FTP in ASCII mode translates
these for you. FTP in binary mode, or other forms of file transfer, such
as Samba, leave the file unaltered. Doing so would be extremely
dangerous, as there's no clear way to isolate which files should be

You can get Windows editors that understand Unix line-end conventions
(Ultra Edit is one), or you can use DOS line endings on the files, which
will then look odd from the Unix side. You can stop using notepad, and
use Wordpad instead, which will deal appropriately with Unix line

You can convert a DOS format text file to Unix with this:-

tr -d '\r' < dosfile.txt > unixfile.txt

The best solution to this seems to be using a Windows editor that can
handle working with Unix line endings.



More information about the samba mailing list