Linux md5sum 命令


通过 Linux 的 md5sum 命令,可以对指定的文件,计算出唯一的一个MD5值(128bit)。

通过比较文件前后的MD5值,可以判断文件是否发生变化(是否被修改过)。


1、md5sum 命令使用方式(通过md5sum --help查看):

Usage: md5sum [OPTION]... [FILE]...
Print or check MD5 (-bit) checksums.
With no FILE, or when FILE is -, read standard input. -b, --binary read in binary mode
-c, --check read MD5 sums from the FILEs and check them
--tag create a BSD-style checksum
-t, --text read in text mode (default)
Note: There is no difference between binary and text mode option on GNU system. The following four options are useful only when verifying checksums:
--quiet don't print OK for each successfully verified file
--status don't output anything, status code shows success
--strict exit non-zero for improperly formatted checksum lines
-w, --warn warn about improperly formatted checksum lines --help display this help and exit
--version output version information and exit The sums are computed as described in RFC . When checking, the input
should be a former output of this program. The default mode is to print
a line with checksum, a character indicating input mode ('*' for binary,
space for text), and name for each FILE. GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'md5sum invocation'

2、计算一个文件的 MD5 值

1)新建一个文件test.txt,内容为 Hello, md5sum.

使用如下命令,生成改文件对应的 MD5 值

md5sum test.txt > md5.out

2)此时会在当前目录下看到生成的 md5.out 文件

3)查看改文件对应的 MD5 值

cat md5.out

4)使用如下命令,比较文件的 MD5 值是否发生变化

md5sum -c md5.out

5)当修改test.txt 文件,增加 Modify 单词,再次对比 MD5 值,会发现不一致

6)BSD格式查看 MD5 值

md5sum --tag md5.out 

Linux md5sum 命令的更多相关文章

  1. linux md5sum命令

    md5sum命令用于生成和校验文件的md5值 生成文件md5值 [root@cdncenter ~]# ll total -rw-r--r-- root root Oct : .txt -rw-r-- ...

  2. 【转】linux命令详解:md5sum命令

    [转]linux命令详解:md5sum命令 转自:http://blog.itpub.net/29320885/viewspace-1710218/ 前言 在网络传输.设备之间转存.复制大文件等时,可 ...

  3. linux命令详解:md5sum命令

    前言 在网络传输.设备之间转存.复制大文件等时,可能会出现传输前后数据不一致的情况.这种情况在网络这种相对更不稳定的环境中,容易出现.那么校验文件的完整性,也是势在必行的. 使用说明 md5sum命令 ...

  4. linux命令学习笔记-md5sum 命令详解

    前言 在网络传输.设备之间转存.复制大文件等时,可能会出现传输前后数据不一致的情况.这种情况在网络这种相对更 不稳定的环境中,容易出现.那么校验文件的完整性,也是势在必行的. 使用说明 md5sum命 ...

  5. 爹地,我找到了!,15个极好的Linux find命令示例

    爹地,我找到了!, 15个极好的Linux find命令示例 英文原文:Daddy, I found it!, 15 Awesome Linux Find Command Examples 标签: L ...

  6. 妈咪,我找到了! -- 15个实用的Linux find命令示例

    妈咪,我找到了! -- 15个实用的Linux find命令示例 英文原文:Mommy, I found it! — 15 Practical Linux Find Command Examples ...

  7. linux 常用命令大全

    linux 常用命令大全 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统 ...

  8. linux全部命令

    linux全部命令 一.安装和登陆命令1.进入图形界面startx 2.进入图形界面init 5 3.进入字符界面init 3 4.登陆login 5.关机poweroff-p 关闭机器的时候关闭电源 ...

  9. 73条日常Linux shell命令汇总,总有一条你需要!

    转载: 73条日常Linux shell命令汇总,总有一条你需要! 1.检查远程端口是否对bash开放: echo >/dev/tcp/8.8.8.8/53 && echo &q ...

随机推荐

  1. wlan相关查询命令

    1.查看当前连接的设备 hostapd_cli all_sta

  2. Python3学习笔记37-LeetCode刷题

    LeetCode中国官网一个用来刷编程题的网站,收录了很多面试题.感觉还是学习到很多.记录一下思路.代码还是要多敲. 建议编写完后直接在LeetCode上运行和提交.提交时会有不同的测试用例来测试代码 ...

  3. 关于SendMessage和PostMessage的理解的例子

    对于SendMessage 和 PostMessage 平时口头的解释是 SendMessage 发送消息后等待返回, PostMessage 发送消息后立即返回 . 但是这样解释还是不具体,什么叫等 ...

  4. 【组合数学】AGC036C - GP 2

    找性质的能力不行 Problem Statement We have a sequence of $N$ integers: $x=(x_0,x_1,\cdots,x_{N−1})$. Initial ...

  5. JavaScript的7大基本类型

  6. docker国内镜像地址

    https://registry.docker-cn.com http://hub-mirror.c.163.com https://docker.mirrors.ustc.edu.cn

  7. Navicat连接虚拟机上的mysql

    刚刚在虚拟主机上安装mysql,  想使用Navicat 操作mysql.  但是连接不上 报错: 2003 - can't connect to MySQL server on '192.168.1 ...

  8. Java设计模式-策略模式实际应用场景

    容错恢复机制        容错恢复机制是应用程序开发中非常常见的功能.那么什么是容错恢复呢?简单点说就是:程序运行的时候,正常情况下应该按照某种方式来做,如果按照某种方式来做发生错误的话,系统并不会 ...

  9. python 垃圾回收笔记

    目录 引用计数 python内部的引用计数机制 循环引用 调试内存泄漏 总结 python 程序在运行的时候,需要在内存中开辟出一块空间,用于存放运行时产生的临时变量:计算完成后,再将结果输出到永久性 ...

  10. 发布jar项目到maven仓库

    在要发布的项目pom文件中添加配置: <distributionManagement> <repository> <id>releases</id> & ...