Difference between DOS and Unix formats

Solved
smed_79 Posted messages 1298 Registration date   Status Contributor Last intervention   -  
smed_79 Posted messages 1298 Registration date   Status Contributor Last intervention   -
Hello,
I have a text file that is 634 KB when saved in DOS format and 611 KB in Unix format.

I would like to know what the difference is between the two file formats Unix & DOS?
Are Unix files usable on Windows?
If so, how can you convert a DOS file to Unix via the command prompt?

Thank you very much.

Configuration: ASUS G46VW | Manjaro 0.8.9 | LibreOffice | Firefox

2 answers

  1. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501
     
    Hi,

    I think the difference in size mainly comes from the line endings, which differ depending on the system.
    Unix uses the newline character (\n), while DOS also uses this character but preceded by a carriage return (\r\n).

    As for modifying a file from the command line, under GNU/Linux (Unix), there are two utilities for that,
    dos2unix
    and
    unix2dos
    which convert the format to each other.

    You can also do this with tools like sed, perl, or others.

    See in the FAQ: DOS (CRLF) / UNIX (LF) carriage return conversion

    --
    Zen my nuggets ;-)
    Do something for the environment, close your windows and adopt a penguin. <('')
    2
    1. smed_79 Posted messages 1298 Registration date   Status Contributor Last intervention   850
       
      Thank you very much, I understand well :) and I also found this link http://soft.zoneo.net/Linux/dos_et_unix.php
      0