fdupes - Linux-da dublikat faýllary tapmak we ýok etmek üçin buýruk setiri guraly


Kompýuter ulanyjylarynyň köpüsi üçin dublikat faýllary tapmak we çalyşmak umumy talap. Dublikat faýllary tapmak we aýyrmak wagt we sabyr talap edýän ýadaw iş. “Fdupes” kömegi bilen enjamyňyz GNU/Linux bilen işleýän bolsa, dublikat faýllary tapmak gaty aňsat bolup biler.

Fdupes, Adrian Lopeziň MIT Ygtyýarnamasy esasynda çykan C programmirleme dilinde ýazan Linux programmasy. Programma, berlen kataloglar we kiçi kataloglar toplumynda dublikat faýllary tapyp bilýär. Fdupes, faýllaryň MD5 goluny deňeşdirip, baýtdan baýt deňeşdirmek arkaly dublikatlary tanadýar. Fdupes bilen faýllary sanamak, pozmak we gaty baglanyşyklar bilen çalyşmak üçin köp sanly wariant geçip biler.

Deňeşdirme tertipde başlaýar:

ululygy deňeşdirmek> Bölekleýin MD5 gol deňeşdirmesi> Doly MD5 gol deňeşdirmesi> Baýt-baýt deňeşdirme.

Linux-da fdupes guruň

Ubudu we Linux Mint ýaly Debian esasly ulgamlarda aşakdaky buýrugy ýerine ýetirmek ýaly fdupes (fdupes 1.51 wersiýasy) iň soňky wersiýasyny gurmak.

$ sudo apt-get install fdupes

CentOS/RHEL we Fedora esasly ulgamlarda, fdupes paketini gurmak üçin epel ammaryny açmaly.

# yum install fdupes
# dnf install fdupes    [On Fedora 22 onwards]

Bellik: Adaty paket dolandyryjysy yum, Fedora 22-den başlap dnf bilen çalşylýar…

Fdupes buýrugyny nädip ulanmaly?

1. Görkeziş maksady bilen, bir katalogyň aşagynda birnäçe dublikat faýl döredeliň (tekmint diýiň):

$ mkdir /home/"$USER"/Desktop/tecmint && cd /home/"$USER"/Desktop/tecmint && for i in {1..15}; do echo "I Love Tecmint. Tecmint is a very nice community of Linux Users." > tecmint${i}.txt ; done

Aboveokardaky buýrukdan soň, dslikat faýllaryň döredilendigini ýa-da ls buýrugyny ulanmaýandygyny barlalyň.

$ ls -l

total 60
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint10.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint11.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint12.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint13.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint14.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint15.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint1.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint2.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint3.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint4.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint5.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint6.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint7.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint8.txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9.txt

Aboveokardaky skript, tecmint1.txt, tecmint2.txt… tecmint15.txt ýaly 15 faýl döredýär we her faýlda şol bir maglumat bar, ýagny

"I Love Tecmint. Tecmint is a very nice community of Linux Users."

2. Indi tekmint bukjasynyň içinde dublikat faýllary gözläň.

$ fdupes /home/$USER/Desktop/tecmint 

/home/tecmint/Desktop/tecmint/tecmint13.txt
/home/tecmint/Desktop/tecmint/tecmint8.txt
/home/tecmint/Desktop/tecmint/tecmint11.txt
/home/tecmint/Desktop/tecmint/tecmint3.txt
/home/tecmint/Desktop/tecmint/tecmint4.txt
/home/tecmint/Desktop/tecmint/tecmint6.txt
/home/tecmint/Desktop/tecmint/tecmint7.txt
/home/tecmint/Desktop/tecmint/tecmint9.txt
/home/tecmint/Desktop/tecmint/tecmint10.txt
/home/tecmint/Desktop/tecmint/tecmint2.txt
/home/tecmint/Desktop/tecmint/tecmint5.txt
/home/tecmint/Desktop/tecmint/tecmint14.txt
/home/tecmint/Desktop/tecmint/tecmint1.txt
/home/tecmint/Desktop/tecmint/tecmint15.txt
/home/tecmint/Desktop/tecmint/tecmint12.txt

3. -r opsiýasyny ulanyp, aşaky kataloglary goşmak bilen, her bir katalogda dublikatlary yzygiderli gözläň.

Fileshli faýllary we bukjalary yzygiderli gözleýär, faýllaryň we bukjalaryň sanyna baglylykda dublikatlary skanirlemek üçin birnäçe wagt gerek bolar. Şol wagt size terminalyň umumy ösüşi, şuňa meňzeş bir zat hödürlener.

$ fdupes -r /home

Progress [37780/54747] 69%

4. -S opsiýasyny ulanyp bukjanyň içinde tapylan dublikatlaryň ululygyna serediň.

$ fdupes -S /home/$USER/Desktop/tecmint

65 bytes each:                          
/home/tecmint/Desktop/tecmint/tecmint13.txt
/home/tecmint/Desktop/tecmint/tecmint8.txt
/home/tecmint/Desktop/tecmint/tecmint11.txt
/home/tecmint/Desktop/tecmint/tecmint3.txt
/home/tecmint/Desktop/tecmint/tecmint4.txt
/home/tecmint/Desktop/tecmint/tecmint6.txt
/home/tecmint/Desktop/tecmint/tecmint7.txt
/home/tecmint/Desktop/tecmint/tecmint9.txt
/home/tecmint/Desktop/tecmint/tecmint10.txt
/home/tecmint/Desktop/tecmint/tecmint2.txt
/home/tecmint/Desktop/tecmint/tecmint5.txt
/home/tecmint/Desktop/tecmint/tecmint14.txt
/home/tecmint/Desktop/tecmint/tecmint1.txt
/home/tecmint/Desktop/tecmint/tecmint15.txt
/home/tecmint/Desktop/tecmint/tecmint12.txt

5. -S we -r opsiýalaryny şol bir wagtyň özünde ulanyp gören her bir katalog we kiçi bukjalar üçin dublikat faýllaryň ululygyny görüp bilersiňiz:

$ fdupes -Sr /home/avi/Desktop/

65 bytes each:                          
/home/tecmint/Desktop/tecmint/tecmint13.txt
/home/tecmint/Desktop/tecmint/tecmint8.txt
/home/tecmint/Desktop/tecmint/tecmint11.txt
/home/tecmint/Desktop/tecmint/tecmint3.txt
/home/tecmint/Desktop/tecmint/tecmint4.txt
/home/tecmint/Desktop/tecmint/tecmint6.txt
/home/tecmint/Desktop/tecmint/tecmint7.txt
/home/tecmint/Desktop/tecmint/tecmint9.txt
/home/tecmint/Desktop/tecmint/tecmint10.txt
/home/tecmint/Desktop/tecmint/tecmint2.txt
/home/tecmint/Desktop/tecmint/tecmint5.txt
/home/tecmint/Desktop/tecmint/tecmint14.txt
/home/tecmint/Desktop/tecmint/tecmint1.txt
/home/tecmint/Desktop/tecmint/tecmint15.txt
/home/tecmint/Desktop/tecmint/tecmint12.txt

107 bytes each:
/home/tecmint/Desktop/resume_files/r-csc.html
/home/tecmint/Desktop/resume_files/fc.html

6. Bir bukjada ýa-da ähli bukjalarda yzygiderli gözlemekden başga, talap edilişi ýaly iki bukjada ýa-da üç bukjada saýlap bilersiňiz. Gerek bolsa -S we/ýa -r opsiýasyny ulanyp bilersiňiz.

$ fdupes /home/avi/Desktop/ /home/avi/Templates/

7. Göçürmäni saklanyňyzda dublikat faýllary pozmak üçin -d opsiýasyny ulanyp bilersiňiz. Bu opsiýany ulananyňyzda goşmaça seresap bolmaly, ýogsam zerur faýllary/maglumatlary ýitirip bilersiňiz we amalyň öwezini dolup bolmajakdygyny ýadyňyzdan çykaryp bilersiňiz.

$ fdupes -d /home/$USER/Desktop/tecmint

[1] /home/tecmint/Desktop/tecmint/tecmint13.txt
[2] /home/tecmint/Desktop/tecmint/tecmint8.txt
[3] /home/tecmint/Desktop/tecmint/tecmint11.txt
[4] /home/tecmint/Desktop/tecmint/tecmint3.txt
[5] /home/tecmint/Desktop/tecmint/tecmint4.txt
[6] /home/tecmint/Desktop/tecmint/tecmint6.txt
[7] /home/tecmint/Desktop/tecmint/tecmint7.txt
[8] /home/tecmint/Desktop/tecmint/tecmint9.txt
[9] /home/tecmint/Desktop/tecmint/tecmint10.txt
[10] /home/tecmint/Desktop/tecmint/tecmint2.txt
[11] /home/tecmint/Desktop/tecmint/tecmint5.txt
[12] /home/tecmint/Desktop/tecmint/tecmint14.txt
[13] /home/tecmint/Desktop/tecmint/tecmint1.txt
[14] /home/tecmint/Desktop/tecmint/tecmint15.txt
[15] /home/tecmint/Desktop/tecmint/tecmint12.txt

Set 1 of 1, preserve files [1 - 15, all]: 

Thehli dublikatlaryň sanawda görkezilendigini görüp bilersiňiz, ýa-da bir ýa-da belli bir aralykda ýa-da hemmesini bir gezekde pozmak soralýar. Belli bir aralykdaky faýl faýllaryny ýok etmek üçin aşakdaky ýaly bir diapazony saýlap bilersiňiz.

Set 1 of 1, preserve files [1 - 15, all]: 2-15

   [-] /home/tecmint/Desktop/tecmint/tecmint13.txt
   [+] /home/tecmint/Desktop/tecmint/tecmint8.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint11.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint3.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint4.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint6.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint7.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint9.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint10.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint2.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint5.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint14.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint1.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint15.txt
   [-] /home/tecmint/Desktop/tecmint/tecmint12.txt

8. Howpsuzlyk nukdaýnazaryndan, “fdupes” -iň çykyşyny faýla çap edip, haýsy faýly pozmalydygyny kesgitlemek üçin tekst faýlyny barlap bilersiňiz. Bu faýlyňyzy tötänleýin ýok etmek mümkinçiligini azaldar. Edip bilersiňiz:

$ fdupes -Sr /home > /home/fdupes.txt

Bellik:/home -ni isleýän bukjanyňyz bilen çalşyp bilersiňiz. Gaýtadan gözlemek isleseňiz, degişlilikde “-r” we “-S” opsiýalaryny ulanyň.

9. “-f” opsiýasyny ulanyp, her bir gabat gelýän toplumdan ilkinji faýly aýryp bilersiňiz.

Ilki bilen katalogyň faýllaryny sanaň.

$ ls -l /home/$USER/Desktop/tecmint

total 20
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9 (3rd copy).txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9 (4th copy).txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9 (another copy).txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9 (copy).txt
-rw-r--r-- 1 tecmint tecmint 65 Aug  8 11:22 tecmint9.txt

soň her gabat gelýän toplumdan birinji faýly aýyryň.

$ fdupes -f /home/$USER/Desktop/tecmint

/home/tecmint/Desktop/tecmint9 (copy).txt
/home/tecmint/Desktop/tecmint9 (3rd copy).txt
/home/tecmint/Desktop/tecmint9 (another copy).txt
/home/tecmint/Desktop/tecmint9 (4th copy).txt

10. fdupes-iň gurnalan wersiýasyny barlaň.

$ fdupes --version

fdupes 1.51

11. Fdupes-de haýsydyr bir kömek gerek bolsa, -h wyklýuçatelini ulanyp bilersiňiz.

$ fdupes -h

Usage: fdupes [options] DIRECTORY...

 -r --recurse     	for every directory given follow subdirectories
                  	encountered within
 -R --recurse:    	for each directory given after this option follow
                  	subdirectories encountered within (note the ':' at
                  	the end of the option, manpage for more details)
 -s --symlinks    	follow symlinks
 -H --hardlinks   	normally, when two or more files point to the same
                  	disk area they are treated as non-duplicates; this
                  	option will change this behavior
 -n --noempty     	exclude zero-length files from consideration
 -A --nohidden    	exclude hidden files from consideration
 -f --omitfirst   	omit the first file in each set of matches
 -1 --sameline    	list each set of matches on a single line
 -S --size        	show size of duplicate files
 -m --summarize   	summarize dupe information
 -q --quiet       	hide progress indicator
 -d --delete      	prompt user for files to preserve and delete all
                  	others; important: under particular circumstances,
                  	data may be lost when using this option together
                  	with -s or --symlinks, or when specifying a
                  	particular directory more than once; refer to the
                  	fdupes documentation for additional information
 -N --noprompt    	together with --delete, preserve the first file in
                  	each set of duplicates and delete the rest without
                  	prompting the user
 -v --version     	display fdupes version
 -h --help        	display this help message

Bu häzirlikçe. Linux-da şu wagta çenli dublikat faýllary nädip tapýandygyňyzy we pozýandygyňyzy maňa habar beriň? şeýle hem bu peýdalylyk hakda öz pikiriňizi aýdyň. Gymmat bahaly pikirleriňizi aşakdaky teswirler bölüminde goýuň we bizi halamagy/paýlaşmagy we ýaýramaga kömek etmegi ýatdan çykarmaň.

Dublikat faýllary aýyrmak üçin fslint atly başga bir kömekçi enjamyň üstünde işleýärin, ýakyn wagtda iberersiňiz we siz okamagy halaýarsyňyz.