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. 09_Redis_消息订阅与发布

    一:Redis 发布订阅 Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息. Redis 客户端可以订阅任意数量的频道. 下图展示了频道 c ...

  2. 02_Redis数据类型

    Redis 数据类型:键值对存储 Redis支持五种数据类型:string(字符串),hash(哈希),list(列表),set(集合)及zset(sorted set:有序集合). 注意:key:全 ...

  3. python_三元运算符

    三元运算又称三目运算,是对简单的条件语句的简写 简单条件语句: if 条件成立: val = 1 else: val = 2 改成三元运算: val = 1 if 条件成立 else 2 举例: a ...

  4. c#使用 NServiceKit.Redis 封装 RedisHelper

    在说StackExchange.Redis 的时候说了,因为我们的项目一直.net4.0不升级,没有办法,我说的不算,哈哈,又查了StackExchange.Redis在.net4.0使用麻烦,所以选 ...

  5. django.core.exceptions.ImproperlyConfigured: The included URLconf 's9luffycity.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused

    出现问题: $ python manage.py runserver 启动项目报错时候 raise ImproperlyConfigured(msg.format(name=self.urlconf_ ...

  6. HDU 6048 - Puzzle | 2017 Multi-University Training Contest 2

    /* HDU 6048 - Puzzle [ 思维,结论 ] | 2017 Multi-University Training Contest 2 题意: 类似华容道的问题, N*M 的矩阵中N*M- ...

  7. 添加Mybatis

  8. springbooot+restful目录规则

    dao是访问数据层,dto是数据传出层,po实体类

  9. HDOJ4467 ( 分块 思想 )

    题目:链接:http://acm.hdu.edu.cn/showproblem.php?pid=4467 题意:给你n个点(每个点都有一个颜色,0代表黑色,1代表白色),m条边,每条边有一个权值.现在 ...

  10. CUDA-F-5-5-常量内存

    title: [CUDA 基础]5.5 常量内存 categories: - CUDA - Freshman tags: - CUDA常量内存 - CUDA只读缓存 toc: true date: 2 ...