Convert Windows line endings to Linux line endings using vim

Windows uses the CR/LF characters (Carriage Return and Line Feed) to indicate a line-ending. Under Linux this is only one character, LF. You might see some strange characters at line-endings when editing a file in Linux that was saved in Windows.

To convert these line endings under Linux perform the following steps:

  • Edit the file with vim
  • Give the command :set ff=unix
  • Save the file

Solution Source