How to change the line endings in Linux

Check line endings

Using file command

file abc.txt

Result:

  • Unix:
abc.txt: ASCII text
  • DOS:
abc.txt: ASCII text, with CRLF line terminators

Change line endings

Using dos2unix command

dos2unix abc.txt

Using unix2dos command

unix2dos abc.txt



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • How to debug MSVC in release mode
  • How to find the vc runtime version from an exe
  • How to debug local variable and lambda on c++ release build
  • Why auto is bad in c++
  • Deep Copy/Shadow Copy an Object in Java