生成校验和核验命令-md5sum

md5sum

最知名且使用最为广泛的校验和技术是md5sum和SHA-1。

1.生成md5校验位

计算md5sum:

[root@nginx ~]# md5sum anaconda-ks.cfg
858a6131c92c673b8e5d795d2ffde411  anaconda-ks.cfg

# md5sum filename > file_sum.md5 

2.核实数据完整性

[root@nginx ~]# md5sum -c filename.md5
anaconda-ks.cfg: OK

对所有.md5信息核实
md5sum -c *.md5

3.对目录进行校验

用命令md5deep或sha1deep来实现,需安装md5deep包

[root@nginx ~]# md5deep -rl /etc/nginx/ > tmp.md5
# -r使用递归的方式
# -l使用相对路径。默认情况下,md5deep会输出文件的绝对路径

对整个目录核验:

[root@nginx ~]# md5sum  -c tmp.md5
/etc/nginx/conf.d/default.conf: OK
/etc/nginx/fastcgi_params: OK
/etc/nginx/koi-utf: OK
/etc/nginx/koi-win: OK

猜你喜欢

转载自blog.csdn.net/qq_37126850/article/details/107445905