The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 2,199     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: November 24, 2022    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: greping 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'
⇧ How can I copy /home and / to new partitions on the same drive which I can boot into for testing. Ubuntu 17.10 - Poweroff operation is inhibited by myself  ⇩