By default, the dos2unix tool is not installed in Ubuntu, and there is no tool named this name (I have used dos2unix in solaris, but I don't know why Ubuntu does not ). However, there is an alternative tool, tofrodos. Next we will talk about its installation and use. Of course, it is still apt installation. (1) install tofrodossudoapt-getinstalltofrodos. In fact, it installs two tools: todos (equivalent to unix2dos)
By default, the dos2unix tool is not installed in Ubuntu, and there is no tool named this name (I have used dos2unix in solaris, but I don't know why Ubuntu does not ). However, there is an alternative tool, tofrodos. Next we will talk about its installation and use.
Of course, it is still apt installation.
(1) install tofrodos
Sudo apt-get install tofrodos
In fact, it installs two tools: todos (equivalent to unix2dos) and fromdos (equivalent to dos2unix)
After installation, you can convert the text format.
For example, todos Hello.txt (unix2dos Hello.txt)
Fromdos Hello.txt (dos2unix Hello.txt)
(2) Make some optimizations
As you get used to unix2dos and dos2unix commands, you can link the two tools installed above to unix2dos and dos2unix, or just create an alias and put it in the startup script.
Steps:
Ln-s/usr/bin/todos/usr/bin/unix2dos
Ln-s/usr/bin/fromdos/usr/bin/dos2unix
Or in ~ /. Alias in bashrc
Vi ~ /. Bashrc
Add alias unix2dos = todos alias dos2unix = fromdos