Linux常用命令--dos2unix

发布时间:2020-06-09 23:28:33 作者:三国冷
来源:网络 阅读:508

1.功能:DOS/MAC文件转化成UNIX文件格式,功能跟notepad编辑器下的编辑-文档格式转换-转换为UNIX格式一样

2.安装方式:yum install -y dos2unix

3.语法:

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

4.参数:

-h --help 帮助

-k --keepdate 时间戳保持不变

-q --quiet 静默模式,不输出告警和信息

              Quiet mode. Suppress all warning and messages.

-c --convmode 设定转化模式,模式有:ASCII, 7bit, ISO

-o --oldfile file 默认模式,将转换后的文件直接写到原文件中

-n --newfile infile outfile  将infile中的内容写入到outfile中

5.例子

[mysql@mysql ~]$ ls -lh

total 12K

-rw-r--r--. 1 root  root 31 Jun 29 15:43 echo_test.sh

-rw-r--r--. 1 root  root 18 Jun 29 15:41 test.txt

-rw-r--r--. 1 mysql dba  68 Jun 23 22:47 week.txt

#中间把test.txt、week.txt删除#

[mysql@mysql ~]$ dos2unix -k echo_test.sh 

dos2unix: converting file echo_test.sh to UNIX format ...

[mysql@mysql ~]$ ls -lh

total 4.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 15:43 echo_test.sh#时间戳未变


[mysql@mysql ~]$ dos2unix  echo_test.sh 

dos2unix: converting file echo_test.sh to UNIX format ...

[mysql@mysql ~]$ ls -lh

total 4.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 echo_test.sh#时间戳变化

[mysql@mysql ~]$ dos2unix  -n echo_test.sh  test.sh 

dos2unix: converting file echo_test.sh to file test.sh in UNIX format ...

[mysql@mysql ~]$ ls -lh

total 8.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 echo_test.sh

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 test.sh


推荐阅读:
  1. linux常用命令
  2. linux下dos2unix

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux dos unix

上一篇:数据在磁盘上的布局

下一篇:路由器改交换机设置

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》