There was a problem when I copied a Text file from Linux to Windows. The Text was not as the original, it was shifted to almost one line, also the line break setting couldn't help. The content was from a website and it was copied in the right format as on the website to the text file on Linux.

I used then on Windows the comandline tool more:

more < textfile.txt > formatted.txt

So I could get back the original format.

Is there some configuration which might hold the format directly when copying the file between Linux and Windows ?


Before copying, use the Linux utility unix2dos: UNIX to DOS text file format converter.

After copying back from Windows, use the Linux utility dos2unix: DOS/MAC to UNIX text file format converter.

Other utilities and programming libraries can perform this line-ending conversion as well.

  • Hi, thanks. Is there a way to do it for multiple files, thru the mentioned tool ? – Tech-IO Feb 17 '17 at 8:02
  • Just specify all file names on the command line. From the manual: "Convert and replace a.txt. Convert and replace b.txt. unix2dos a.txt b.txt" – Steven Feb 17 '17 at 16:12
  • Yes, thank you, I will try it. Maybe something with *.txt could work too. – Tech-IO Feb 17 '17 at 20:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.