華為云計算 云知識 如何安裝dos2unix
如何安裝dos2unix

簡介

dos2unix是將Windows格式文件轉換為Unix、Linux格式的實用命令。Windows格式文件的換行符為“\r\n”,而Unix&Linux文件的換行符為“\n”。dos2unix命令其實就是將文件中的“\r\n”轉換為“\n”。而unix2dos與dos2unix相反,它是將Linux和Unix格式文件轉換為Windows格式文件的命令。

編譯和測試方式

1.編譯和安裝

CentOS 7.6中自帶dos2unix安裝包,直接使用yum命令安裝。

yum install dos2unix -y

回顯信息如下,則dos2unix安裝完成:

Installed:

  dos2unix.aarch64 0:6.0.3-7.el7                                                                                             

Complete!

2.運行和驗證

查詢dos2unix版本號。

dos2unix --version

回顯信息如下,則表示dos2unix安裝成功。

dos2unix 6.0.3 (2013-01-25)

With Unicode UTF-16 support.

With native language support.

LOCALEDIR: /usr/share/locale