emacs, convert dos to unix and vice versa

If in emacs you need a different file coding system (line terminator), for example you are on a windows system and need to type a unix like text file (or vice versa), you can easily convert the buffer coding system.

Dos to unix

M-x set-buffer-file-coding-system RET undecided-unix
save the file (C-x C-s)

or

C-x RET f undecided-unix
C-x C-f

Unix to dos

M-x set-buffer-file-coding-system RET undecided-dos
save the file (C-x C-s)

or

C-x RET f undecided-dos
C-x C-f

15 thoughts on “emacs, convert dos to unix and vice versa

  1. Everything is very open with a precise description of the challenges.

    It was definitely informative. Your website is very useful.

    Thanks for sharing!

  2. g00by says:

    Thanks, this was something I was looking for after making a python code in windows and moving it to linux. After hours of frustration I realised it was all due to line endings. 🙂

  3. Nice weblog here! Also your website a lot up very
    fast! What web host are you the use of? Can I get your affiliate
    hyperlink to your host? I want my site loaded up as quickly as yours lol

Leave a comment