Need some assistance here... I can tar a file and I can gzip the tar'ed file but... when I download the gzipped tarfile and uncompress it on WIN/XP and go to edit an html file, it always prompts asking if I want to convert it to DOS format. Is there any way around that? It is very annoying.

here's the commands I used....

tar -cvf foo.tar foo.com/

gzip -c foo.tar >

I am not a linux guru but need to get up to speed on this as I have 3 servers to move.

Thanks,

DougC

Dani AI

Generated

— building on 's point about line endings, the prompt you see on Windows is the classic CRLF vs LF mismatch. Two practical ways to stop the prompts: produce archives that contain Windows-style line endings, or keep the files as Unix-style and use Windows tools that accept LF.

If you want the archive to be Windows-friendly, create the archive from files with CRLF line endings (do this only for text files). On Linux you can convert text files in a safe, test-first way; for example, run a conversion on copies and target only HTML/CSS/JS/etc. Use a tested one-liner on a copy before packaging:

perl -pi -e 's/(?<!\r)\n/\r\n/g' *.html

For source control and ongoing work, Git has built‑in line-ending handling (core.autocrlf and .gitattributes) so checkouts on Windows get CRLF while the repo stores LF. See the Git docs for recommended settings: Git core.autocrlf.

When moving archives between machines, always transfer compressed archives in binary mode; FTP ASCII mode can mangle archives. Prefer SFTP/HTTP or verify with checksums after download. (Background on transfer modes: FTP transmission modes.)

Quick troubleshooting tips:

  • Inspect bytes to confirm endings: run a hex dump and look for 0d 0a (CRLF) versus 0a (LF).
  • Convert only text files and keep backups before batch changes.
  • If distributing to end users, consider shipping a .zip (Windows-native tools generally preserve CRLF) or advise using editors that tolerate LF (Notepad++/VS Code) to avoid repeated conversion dialogs.

For packaging options on Unix see the zip tool manual for platform-friendly choices: zip(1) manual.

Recommended Answers

All 3 Replies

More likely it has to do with the way the text files are encoded than the how you compress them. Unix-encoded files have different newlines than their DOS/Windows counterparts, which means you'll need to convert them every time you edit them with a different operating system. I use the dos2unix tool on the Unix side; I'm not sure about Windows, but from the sounds of it, you can just let Notepad convert it.

An alternative to this would be to just leave the files in DOS encoding, seeing that most Unix text editors can read it just fine...

Thanks for your comments John.

These are all files that I created on my PC (Windows machine). I uploaded them as ascii.

Hmm, not sure how it happened, but try running this in each directory that contains text files:

unix2dos *

If you don't have this utility, use Google to find the appropriate package to install for your system. It automatically skips over binary files, so you don't need to worry about it messing up images, programs, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.