unix2dos 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

unix2dos 命令安装:


-bash: unix2dos: command not found
 
#CentOS/RHEL 安装
yum install -y dos2unix
 
#Debian/Ubuntu 安装
sudo apt-get install tofrodos
 
#实际上它安装了两个工具:todos(相当于unix2dos),和fromdos(相当于dos2unix)
todos Hello.txt (即 unix2dos Hello.txt) 
fromdos Hello.txt (即 dos2unix Hello.txt)

---------
#Debian
apt-get install dos2unix

#Ubuntu
apt-get install dos2unix

#Alpine
apk add dos2unix

#Arch Linux
pacman -S dos2unix

#Kali Linux
apt-get install dos2unix

#CentOS
yum install dos2unix

#Fedora
dnf install dos2unix

#OS X
brew install dos2unix

#Raspbian
apt-get install dos2unix

#Docker
docker run cmd.cat/unix2dos unix2dos

unix2dos 命令补充说明:


dos2unix 命令将纯文本文件从 Unix 转换为 DOS或Mac格式。

unix2dos 命令语法:


unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...]

unix2dos 命令选项:


-k:保持输出文件的日期不变
-q:安静模式,不提示任何警告信息。
-V:查看版本
-c:转换模式,模式有:ASCII, 7bit, ISO, Mac, 默认是:ASCII。
-o:写入到源文件
-n:写入到新文件

unix2dos 命令参数:


参数:需要转换到文件。

unix2dos 命令实例


转换并替换 a.txt。 转换并替换 b.txt。

unix2dos a.txt b.txt

转换 a.txt 并写入 e.txt,使 e.txt 的日期戳与 a.txt 相同。

unix2dos -k -n a.txt e.txt

unix2dos 命令扩展阅读:




unix2dos 命令评论