Views:
2,613
Votes: 2
Tags:
command-line
files
text-processing
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1010619
Title:
Find an identical file with a different name
ID:
/2018/02/28/Find-an-identical-file-with-a-different-name
Created:
February 28, 2018
Edited: June 12, 2020
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
Grep can find it quickly
When used properly, the grep
command can find the duplicate quickly. You must be careful not to search the whole file system or it will take days to complete. I recently documented this here: grep
ing all files for a string takes a long time
For optimum speed use:
grep -rnw --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e 'String in file'
If your file might be on a Windows directory remove the mnt
directory.
If you know the file is within the /home
directory someplace you can shorten the command:
grep -rnw '/home' -e 'String in file'