日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

Linux md5sum 的用法

發(fā)布時間:2023/12/13 综合教程 47 生活家
生活随笔 收集整理的這篇文章主要介紹了 Linux md5sum 的用法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MD5 算法常常被用來驗(yàn)證網(wǎng)絡(luò)文件傳輸?shù)耐暾裕乐刮募淮鄹摹D5 全稱是報文摘要算法,此算法對任意長度

的信息逐位計算,產(chǎn)生一個二進(jìn)制長度為 128 位(十六進(jìn)制長度 32 位)的報文摘要,不同的文件產(chǎn)生相同的報文摘要的可

能性非常小。

在 Linux 上,md5sum 是用來計算和校驗(yàn)文件報文摘要的工具程序。一般來說,安裝了 Linux 后,就會有 md5sum 這

個工具,直接在命令行終端直接運(yùn)行。

1.使用 md5sum 來產(chǎn)生報文摘要命令如下:

md5sum file > file.md5 
或
md5sum file >> file.md5

  也可以把多個文件的報文摘要輸出到一個文件中,這需要使用通配符 * ,比如某目錄下有幾個 iso 文件,要把這幾個iso

文件的報文摘要輸出到 iso.md5 文件中,命令如下:

md5sum *.iso > iso.md5

  2.使用 md5 報文摘要驗(yàn)證文件

2.1 把下載的文件 file 和 該文件的 file.md5 報文摘要放在同一個目錄下,然后用如下命令進(jìn)行驗(yàn)證:

md5sum -c file.md5

   2.2 使用 md5sum file 命令會輸出一個 md5 的報文摘要,然后把這個報文摘要直接與 file.md5 中的內(nèi)容比較。

示例如下:

[root@VM_81_181_centos ~]# mkdir test
[root@VM_81_181_centos ~]# cd test/
[root@VM_81_181_centos test]# touch f1.txt f2.txt
[root@VM_81_181_centos test]# ls
f1.txt  f2.txt
[root@VM_81_181_centos test]# md5sum *.txt > md5sumtest.md5
[root@VM_81_181_centos test]# cat md5sumtest.md5 
d41d8cd98f00b204e9800998ecf8427e  f1.txt
d41d8cd98f00b204e9800998ecf8427e  f2.txt
[root@VM_81_181_centos test]# echo "hahaha" > f1.txt 
[root@VM_81_181_centos test]# md5sum -c md5sumtest.md5 
f1.txt: FAILED
f2.txt: OK
md5sum: WARNING: 1 computed checksum did NOT match
[root@VM_81_181_centos test]# echo "hahaha" > f2.txt 
[root@VM_81_181_centos test]# md5sum -c md5sumtest.md5 
f1.txt: FAILED
f2.txt: FAILED
md5sum: WARNING: 2 computed checksums did NOT match
[root@VM_81_181_centos test]# cat /dev/null > f1.txt 
[root@VM_81_181_centos test]# md5sum -c md5sumtest.md5 
f1.txt: OK
f2.txt: FAILED
md5sum: WARNING: 1 computed checksum did NOT match
[root@VM_81_181_centos test]# cat /dev/null > f2.txt 
[root@VM_81_181_centos test]# md5sum -c md5sumtest.md5 
f1.txt: OK
f2.txt: OK
[root@VM_81_181_centos test]# 

  生成一個文件的 md5 值

[root@VM_81_181_centos test]# md5sum f1.txt 
d41d8cd98f00b204e9800998ecf8427e  f1.txt

  

總結(jié)

以上是生活随笔為你收集整理的Linux md5sum 的用法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。