The best way to verify file integrity (i.e. large file downloaded from internet) is by generating a Checksum/Hash and check if it matches.
BaSH
1 2 |
[boss@scriptingbox ~]# md5sum servers.txt 1aefcf0fd2b48f0b2e9633bdf27c9f95 servers.txt |
PowerShell
1 2 3 4 5 |
PS C:\Users\system.team\Documents> Get-FileHash -Algorithm MD5 .\servers.txt | ft -AutoSize Algorithm Hash Path --------- ---- ---- MD5 1AEFCF0FD2B48F0B2E9633BDF27C9F95 C:\Users\system.team\Documents\servers.txt |
TIP
If you are looking for a specific file when you know its md5 checksum it’s possible to find it even if was renamed or moved with a simple script like this. Sometimes Malware or Virus are identified by their hash/checksum.
1 2 |
[boss@scriptingbox]:/home/boss# find /home -type f -exec md5sum {} + | grep 'e4216edb5b97abea13dc3efa9f240406' e4216edb5b97abea13dc3efa9f240406 /home/boss/server.txt |