尊龙凯时人生就是博

ʹÓà Linux ²éÕÒÖظ´Îļþ

ÒªÁìÒ»£ºÊ¹ÓÃFindÏÂÁî

±¾²¿·ÖËãÊǶÔfindÇ¿Ê¢¹¦Ð§µÄÀ©Õ¹Ê¹ÓÃÒªÁì˵Ã÷¡£ÔÚfindµÄ»ù´¡ÉÏ £¬ÎÒÃÇ¿ÉÓ루ÈçxargsÏÂÁµÈÆäËü»ù±¾LinuxÏÂÁîÏàÍŽá £¬¼´ÄÜ´´Á¢³öÎÞÏÞµÄÏÂÁîÐй¦Ð§ £¬ºÃ±È£º¿ÉÒÔ¿ìËÙ²éÕÒ³öLinuxij¸öÎļþ¼Ð¼°Æä×ÓÎļþ¼ÐÖеÄÖظ´ÎļþÁбí¡£ÒªÊµÏÖÕâ¸ö¹¦Ð§ÔÚÁ÷³ÌÉÏÊǽÏÁ¿¼òÆ £¬Ö»Òª²éÕÒ±éÀú³öËùÓÐÎļþ £¬ÔÙͨ¹ýÏÂÁîÈ¥½ÏÁ¿Ã¿¸öÎļþµÄMD5¾ÍOKÀ²¡£

ÌýÆðÀ´Ëƺõ½ÏÁ¿Áýͳ £¬×ÅʵÏÂÁî¾ÍÒ»Ìõ£º

find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate

µÇ¼ºó¸´ÖÆ

find -not -empty -type f -printf ¡°%sn¡± ÌåÏÖʹÓÃfindÏÂÁîËÑË÷³öËùÓзǿÕÎļþ £¬ÔÙ´òÓ¡³öËûÃǵľÞϸ

sort -rn ÏÂÁî²»±Ø¶à˵ÁË°Ñ £¬ÕâÌõÏÂÁî¾ÍÊÉÏ´Îļþ¾Þϸ¾ÙÐз´ÏòÅÅÐò

uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 ÌåÏÖÖ»´òÓ¡ÁËÖظ´µÄÐÐ £¬ÕâÀïʹÓôú±í´òÓ¡³öÎļþÃûÏàͬµÄÎļþ

uniq -w32 ¨Call-repeated=separate ×îºóÕâÀïÌåÏÖ¶ÔMD5µÄÇ°32¸ö×Ö½Ú¾ÙÐбÈÕÕ £¬ÒÔɸѡ³öÖظ´Îļþ ʹÓÃÏÂÁîÐеÄÕû¸öÀú³Ì¾ÍÊÇÕâô¼òÆÓºÍÈÝÒס£

ÒªÁì¶þ£ºÊ¹ÓÃdupeGuru¹¤¾ß

DupeGuruÊÇÒ»¸ö¿çƽ̨ӦÓà £¬ÓÐLinux¡¢WindowsºÍMac OS X°æ±¾ £¬Ëü¿ÉÒÔͨ¹ýÎļþ¾Þϸ¡¢MD5ºÍÎļþÃûµÈ¶àÖÖ±ê×¼À´×ÊÖúÓû§ÕÒ³öLinuxÖеÄÖظ´Îļþ¡£UbuntuÓû§¿ÉÒÔÖ±½Óͨ¹ýÌí¼ÓÈçÏÂPPAÔ´À´·½·¨À´¾ÙÐÐ×°Öãº

sudo add-apt-repository ppa:hsoft/ppasudo apt-get updatesudo apt-get install dupeguru*

µÇ¼ºó¸´ÖÆ

ÒªÁìÈý£ºÊ¹ÓÃFindÏÂÁîÆÊÎö

ÔÚÊÂÇéÉúÑĵ±ÖÐ £¬ÎÒÃǺܿÉÄÜ»áÓöµ½²éÕÒÖظ´ÎļþµÄÎÊÌâ¡£ºÃ±È´ÓijÓÎÏ·ÌáÈ¡µÄÓÎÏ·Îı¾ÓÐÖظ´µÄ £¬ÎÒÃÇÏ£ÍûÕÒ³öËùÓÐÖظ´µÄÎı¾ £¬È÷­ÒëÖ»·­ÒëÆäÖÐÒ»·Ý £¬¶øÆäËûµÄÖ±½ÓÌæ»»¡£ÄÇôÕâ¸öÎÊÌâ¸ÃÔõô×öÄØ£¿ËäȻҪÁì¶àÖÖ¶àÑù £¬²¢ÇÒÎÞÂÛÄÇÖÖÒªÁìÓ¦¸Ã¶¼²»»áÌ«ÄÑ £¬µ«±ÊÕßµÚÒ»´ÎÓöµ½Õâ¸öÎÊÌâµÄʱ¼äµÚÒ»·´Ó¦ÊÇÊÇÓÃLinuxµÄShell¾ç±¾ £¬ÒÔÊÇÎı¾ÏÈÈÝÕâÖÖ·½·¨¡£

ÏÈÉÏ´úÂ룺

find -not -empty -type f -printf "%sn" | sort -rn |uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate | cut -b 36-

µÇ¼ºó¸´ÖÆ

¸÷ÈËÏÈcdµ½×Ô¼ºÏëÒª²éÕÒÖظ´ÎļþµÄÎļþ¼Ð £¬È»ºócopyÉÏÃæ´úÂë¾Í¿ÉÒÔÁË £¬ÏµÍ³»á¶ÔÄ¿½ñÎļþ¼Ð¼°×ÓÎļþ¼ÐÄÚµÄËùÓÐÎļþ¾ÙÐвéÖØ¡£

ÏÂÃæÆÊÎöÒ»ÏÂÉÏÃæµÄÏÂÁî¡£

Ê×ÏÈ¿´µÚÒ»¾ä£º

find -not -empty -type f -printf "%sn"

µÇ¼ºó¸´ÖÆ

findÊDzéÕÒÏÂÁ-not -emptyÊÇҪѰÕÒ·Ç¿ÕÎļþ£»-type fÊÇָѰÕÒͨÀýÎļþ£»-printf ¡°%sn¡±½ÏÁ¿¾ßÓÐÒÉ»óÐÔ £¬ÕâÀïµÄ%s²¢·ÇCÓïÑÔÖеÄÊä³ö×Ö·û´® £¬ËüÏÖʵÌåÏÖµÄÊÇÎļþµÄ¾Þϸ £¬µ¥Î»Îªbytes£¨²»¶®¾Íman £¬manÒ»ÏÂfind £¬¾Í¿ÉÒÔ¿´µ½ÁË£© £¬nÊÇ»»Ðзû¡£ÒÔÊÇÕâ¾ä»°µÄÒâ˼ÊÇÊä³öËùÓзǿÕÎļþµÄ¾Þϸ¡£

ËÑË÷ÃñÖÚºÅGitHubÔ³ºǫ́»Ø¸´¡°UML¡± £¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£

ͨ¹ý¹ÜµÀ £¬ÉÏÃæµÄЧ¹û±»´«µ½µÚ¶þ¾ä£º

sort -rn

µÇ¼ºó¸´ÖÆ

sortÊÇÅÅÐò £¬-nÊÇÖ¸°´¾ÞϸÅÅÐò £¬-rÊÇÖ¸´Ó´óµ½Ð¡ÅÅÐò£¨ÄæÐòreverse£©¡£

µÚÈý¾ä£º

uniq -d

µÇ¼ºó¸´ÖÆ

uniqÊÇ°ÑÖظ´µÄÖ»Êä³öÒ»´Î £¬¶ø-dÖ¸Ö»Êä³öÖظ´µÄ²¿·Ö£¨Èç9·ºÆðÁË5´Î £¬ÄÇô¾ÍÊä³ö1¸ö9 £¬¶ø2Ö»·ºÆðÁË1´Î £¬²¢·ÇÖظ´·ºÆðµÄÊý×Ö £¬¹Ê²»Êä³ö£©¡£

µÚËľ䣺

xargs -I{} -n1 find -type f -size {}c -print0

µÇ¼ºó¸´ÖÆ

ÕâÒ»²¿·Ö·ÖÁ½²¿·Ö¿´ £¬µÚÒ»²¿·ÖÊÇxargs -I{} -n1 £¬xargsÏÂÁ֮ǰµÄЧ¹ûת»¯Îª²ÎÊý £¬¹©ºóÃæµÄfindŲÓà £¬ÆäÖÐ-I{}ÊÇÖ¸°Ñ²ÎÊýд³É{} £¬¶ø-n1ÊÇÖ¸½«Ö®Ç°µÄЧ¹ûÒ»¸öÒ»¸öÊäÈë¸øÏÂÒ»¸öÏÂÁ-n8¾ÍÊÇ8¸ö8¸öÊäÈë¸øÏÂÒ»¾ä £¬²»Ð´-n¾ÍÊÇ°Ñ֮ǰµÄЧ¹ûÒ»¹ÉÄԵĸøÏÂÒ»¾ä£©¡£ºó°ë²¿·ÖÊÇfind -type f -size {}c -print0 £¬findÖ¸ÁîÎÒÃÇÇ°Ãæ¼û¹ý £¬-size{}ÊÇÖ¸ÕÒ³ö¾ÞϸΪ{}bytesµÄÎļþ £¬¶ø-print0ÔòÊÇΪÁ˱ÜÃâÎļþÃûÀï´ø¿Õ¸ñ¶øдµÄ²ÎÊý¡£

µÚÎå¾ä£º

xargs -0 md5sum

µÇ¼ºó¸´ÖÆ

xargsÎÒÃÇ֮ǰ˵¹ý £¬Êǽ«Ç°ÃæµÄЧ¹ûת»¯ÎªÊäÈë £¬ÄÇôÕâ¸ö-0ÓÖÊÇʲôÒâ˼£¿manÒ»ÏÂxargs £¬ÎÒÃÇ¿´µ½-0ÌåÏÖ¶ÁÈ¡²ÎÊýµÄʱ¼äÒÔnullΪÍÑÀë·û¶ÁÈ¡ £¬ÕâÒ²²»ÄÑÃ÷È· £¬ÊÂʵnullµÄ¶þ½øÖÆÌåÏÖ¾ÍÊÇ00¡£ºóÃæµÄmd5sumÊÇÖ¸ÅÌËãÊäÈëµÄmd5Öµ¡£

µÚÁù¾ä£ºsortÊÇÅÅÐò £¬Õâ¸öÎÒÃÇÇ°ÃæÒ²¼û¹ý¡£

µÚÆ߾䣺

uniq -w32 --all-repeated=separate

µÇ¼ºó¸´ÖÆ

uniq -w32ÊÇָѰÕÒÇ°32¸ö×Ö·ûÏàͬµÄÐÐ £¬Ôµ¹ÊÔ­ÓÉÔÚÓÚmd5ÖµÒ»¶¨ÊÇ32λµÄ £¬´ËºóÃæµÄ–all-repeated=separateÊÇÖ¸½«Öظ´µÄ²¿·Ö·ÅÔÚÒ»Àà £¬·ÖÀàÊä³ö¡£

µÚ°Ë¾ä£º

cut -b 36-

µÇ¼ºó¸´ÖÆ

ÓÉÓÚÎÒÃǵÄЧ¹û´ø×Åmd5Öµ £¬²»ÊǺÜÔÃÄ¿ £¬ÒÔÊÇÎÒÃǽØÈ¡md5ÖµºóÃæµÄ²¿·Ö £¬cutÊÇÎı¾´¦Àíº¯Êý £¬ÕâÀï-b 36-ÊÇָֻҪÿÐÐ36¸ö×Ö·ûÖ®ºóµÄ²¿·Ö¡£

ÎÒÃǽ«ÉÏÊöÿ¸öÏÂÁîÓùܵÀÁ´½ÓÆðÀ´ £¬´æÈëresult.txt£º

find -not -empty -type f -printf "%sn" | sort -rn |uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate | cut -b 36- >result.txt

µÇ¼ºó¸´ÖÆ

ËäȻЧ¹ûºÜÔÃÄ¿ £¬¿ÉÊÇÓÐÒ»¸öÎÊÌâ £¬ÕâÊÇÔÚLinuxϺÜÔÃÄ¿ £¬ÏÖʵÉÏÈôÊÇÓÐÅóÙ­°ÑÊä³öÎļþ·Åµ½WindowsÉÏ £¬¾Í»á·¢Ã÷»»ÐÐȫûÁË £¬ÕâÊÇÓÉÓÚLinuxϵĻ»ÐÐÊÇn £¬¶øwindowsÒªÇónr £¬ÎªÏàʶ¾öÕâ¸öÎÊÌâ £¬ÎÒÃÇ×îºóÖ´ÐÐÒ»ÌõÖ¸Áî £¬½«nת»»Îªnr£º

cat result.txt | cut -c 36- | tr -s 'n'

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇʹÓà Linux ²éÕÒÖظ´ÎļþµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ