rdfind 命令同样提供了类似忽略空文档(-ignoreempty)和跟踪符号链接(-followsymlinks)的功能 。查看 man 页面获取解释 。
-ignoreempty ignore empty files-minsize ignore files smaller than speficied size-followsymlinks follow symbolic links-removeidentinode remove files referring to identical inode-checksum identify checksum type to be used-deterministic determiness how to sort files-makesymlinks turn duplicate files into symbolic links-makehardlinks replace duplicate files with hard links-makeresultsfile create a results file in the current directory-outputname provide name for results file-deleteduplicates delete/unlink duplicate files-sleep set sleep time between reading files (milliseconds)-n, -dryrun display what would have been done, but don't do it注意 rdfind 命令提供了 -deleteduplicates true 的设置选项以删除副本 。希望这个命令语法上的小问题不会惹恼你 。;-)
$ rdfind -deleteduplicates true ....Deleted 1 files. <==你将可能需要在你的系统上安装 rdfind 命令 。试验它以熟悉如何使用它可能是一个好主意 。
使用 fdupes 命令fdupes 命令同样使得识别重复文件变得简单 。它同时提供了大量有用的选项——例如用来迭代的 -r 。在这个例子中,它像这样将重复文件分组到一起:
$ fdupes ~/home/shs/UPGRADE/home/shs/mytwin/home/shs/lp.txt/home/shs/lp.man/home/shs/penguin.png/home/shs/penguin0.png/home/shs/hideme.png这是使用迭代的一个例子,注意许多重复文件是重要的(用户的 .bashrc 和 .profile 文件)并且不应被删除 。
# fdupes -r /home/home/shark/home.html/home/shark/index.html/home/dory/.bashrc/home/eel/.bashrc/home/nemo/.profile/home/dory/.profile/home/shark/.profile/home/nemo/tryme/home/shs/tryme/home/shs/arrow.png/home/shs/PNGs/arrow.png/home/shs/11/files_11.zip/home/shs/ERIC/file_11.zip/home/shs/penguin0.jpg/home/shs/PNGs/penguin.jpg/home/shs/PNGs/penguin0.jpg/home/shs/Sandra_rotated.png/home/shs/PNGs/Sandra_rotated.pngfdupe 命令的许多选项列如下 。使用 fdupes -h 命令或者阅读 man 页面获取详情 。
-r --recurse recurse-R --recurse: recurse through specified directories-s --symlinks follow symlinked directories-H --hardlinks treat hard links as duplicates-n --noempty ignore empty files-f --omitfirst omit the first file in each set of matches-A --nohidden ignore hidden files-1 --sameline list matches on a single line-S --size show size of duplicate files-m --summarize summarize duplicate files information-q --quiet hide progress indicator-d --delete prompt user for files to preserve-N --noprompt when used with --delete, preserve the first file in set-I --immediate delete duplicates as they are encountered-p --permissions don't soncider files with different owner/group or permission bits as duplicates-o --order=word order files according to specification-i --reverse reverse order while sorting-v --version display fdupes version-h --help displays helpfdupes 命令是另一个你可能需要安装并使用一段时间才能熟悉其众多选项的命令 。
总结linux 系统提供能够定位并(潜在地)能移除重复文件的一系列的好工具,以及能让你指定搜索区域及当对你所发现的重复文件时的处理方式的选项 。
推荐阅读
- 自媒体是如何赚钱的?简单来说可以分为以下10类
- SQL小技巧:一张表中存在两行完全一致的数据,如何删除?
- Linux 目录结构
- 5 个 Linux 新手会犯的失误
- Linux中netstat命令查看网络状态
- Go 中如何优雅关闭子进程?
- 如何排查常见挖矿木马
- Linux命令存放目录bin的体系结构分析
- Linux怎么设置系统环境变量之export命令详解
- JavaScript 究竟是如何工作的?
