菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
15
0

md5sum

原创
05/13 14:22
阅读数 46952
功能说明:md5sum命令用于计算和校验文件的MD5值。
 
参数选项:
-b 二进制模式读取文件。
-c 从指定文件中读取MD5校验值,并进行校验。
-t 文件模式读取文件,这是默认模式。
--quiet 校验文件使用的参数,验证通过不输出OK。
--status 校验文件使用的参数,不输出任何信息,可以通过命令的返回值来判断。
 
校验文件是否发生改变
[root@testdb62 tmp]# touch file.txt
[root@testdb62 tmp]# md5sum file.txt > md5.log
[root@testdb62 tmp]# cat md5.log 
d41d8cd98f00b204e9800998ecf8427e  file.txt
[root@testdb62 tmp]# md5sum -c md5.log 
file.txt: OK
[root@testdb62 tmp]# echo "hello" > file.txt 
[root@testdb62 tmp]# md5sum -c md5.log 
file.txt: FAILED
md5sum: WARNING: 1 computed checksum did NOT match
[root@testdb62 tmp]# md5sum --status -c md5.log 
[root@testdb62 tmp]# echo $?
1

 

发表评论

0/200
15 点赞
0 评论
收藏