Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compare whether two files are the same in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to compare the two files in linux? for this question, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

1. Introduction

MD5 algorithm is often used to verify the integrity of network file transmission and prevent files from being tampered with. The full name of MD5 is message digest algorithm (Message-Digest Algorithm 5). This algorithm calculates any length of information bit by bit and produces a "fingerprint" (or "message digest") with a binary length of 128bits (hexadecimal length is 32 bits). The possibility that different files produce the same message digest is very small.

On linux or Unix, md5sum is a tool program used to calculate and verify the summary of file messages. Generally speaking, after Linux is installed, there will be a md5sum tool that runs directly on the command line terminal.

2. Command format

Md5sum [OPTION]... [FILE]...

3. Command options

-b or-- binary: treat the input file as a binary file.

-t or-- text: treats the input file as a text file (default).

-c or-- check: used to read md5 information from a file to check file consistency. (without going into details, see info)

-- status: this option is used with check. In the case of check, it does not output, but represents the check result based on the return value.

-w or-- warn: in check, check that the input md5 information has no illegal lines, and if so, output the corresponding information.

4. Examples

(1) produce the MD5 value of a file, as shown in the following figure

(2) to check whether the two files are the same, you can compare the MD5 values of the two files.

(3) to judge whether a file is modified or not, judge by md5

The answer to the question about how to compare the two documents in linux is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report