4 Replies - 2568 Views - Last Post: 14 December 2011 - 07:13 AM Rate Topic: -----

#1 purpleheartvet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-April 11

Linux convert Msdos file to unix file

Posted 14 May 2011 - 02:05 PM

I have a question about how to convert an msdos file to Unix using Red Hat Linux. My biggest problem is that I am having trouble changing to my directory from the root. I have asked my professor for help and of course he is no help at all. No real answers to what to do, I have found the command prompt to work with but do not know how to proceed from there.

Any help would be greatly appreciated.

Thanks from a Purple Heart Vet.

Is This A Good Question/Topic? 0
  • +

Replies To: Linux convert Msdos file to unix file

#2 GWatt  Icon User is offline

  • member icon

Reputation: 278
  • View blog
  • Posts: 3,079
  • Joined: 01-December 05

Re: Linux convert Msdos file to unix file

Posted 14 May 2011 - 08:53 PM

The dos2unix and unix2dos programs will convert line endings of text files. If you have a compiled binary that's a different thing.

You can use the cd command to change directories.
Was This Post Helpful? 3
  • +
  • -

#3 westforduk  Icon User is offline

  • D.I.C Head

Reputation: 24
  • View blog
  • Posts: 140
  • Joined: 16-August 07

Re: Linux convert Msdos file to unix file

Posted 16 May 2011 - 09:01 AM

Those commands are not available by default on some systems. The ubuntu package, for example, "dos2unix" will make both of them available if you get an unknown command error.

To test if your conversion has worked you can use the "file" command.

file test.txt



On a Unix file will give: "test.txt: ASCII text"
On a DOS file will give: "test.txt: ASCII text, with CRLF line terminators"
Was This Post Helpful? 0
  • +
  • -

#4 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 253
  • Joined: 29-November 08

Re: Linux convert Msdos file to unix file

Posted 13 December 2011 - 08:08 PM

also if you open your file in vi or vim and it's a dos file there will be a ^M at the end of each line which also marks it as a dos file
Was This Post Helpful? 0
  • +
  • -

#5 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2153
  • View blog
  • Posts: 3,315
  • Joined: 21-June 11

Re: Linux convert Msdos file to unix file

Posted 14 December 2011 - 07:13 AM

View PostBraber01, on 14 December 2011 - 05:08 AM, said:

also if you open your file in vi or vim and it's a dos file there will be a ^M at the end of each line which also marks it as a dos file


In my version of vim the file is displayed normally (i.e. without ^Ms), but it says [dos] in the status line after the file name. Emacs behaves the same way.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1