Get the App
SLTechnology News&Howtos  ›  Servers  › 

Dos2unix under linux

Shulou Source: shulou.com Published: 2022-06-02 15:01:38 11月17日 Update

Dos2unix is not installed by default under ubuntu. Of course, we can install it through sudo apt-get install dos2unix.

In addition, in the absence of dos2unix, we can also use another software to replace-tofrodos, the following describes the use and installation of this software.

(1) use apt command to install on ubuntu

Sudo apt-get install tofrodos

It actually installs two tools: todos (equivalent to unix2dos) and fromdos (equivalent to dos2unix)

After installation, you can now convert the text format.

For example:

Todos Hello.txt (i.e. unix2dos Hello.txt)

Fromdos Hello.txt (i.e. dos2unix Hello.txt)

(2) do some optimization.

Because you are used to the commands of unix2dos and dos2unix, you can link the two tools installed above into unix2dos and dos2unix, or just give them individual names and put them in the startup script.

Steps:

Ln-s / usr/bin/todos / usr/bin/unix2dos

Ln-s / usr/bin/fromdos / usr/bin/dos2unix

Or give a different name in ~ / .bashrc

Vi / .bashrc

Add alias unix2dos=todos

Alias dos2unix=fromdos

Tags: Two commands tools software can be passed through actually situations text formatting steps scripts links Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux vpn Xiaomi MariaDB