天天看点

如何在Linux上找出并删除重复的文件:FSlint如何在Linux上找出并删除重复的文件:FSlint

大家好,今天我们会学习如何在linux pc或者服务器上找出和删除重复文件。这里有一款工具你可以工具自己的需要使用。

无论你是否正在使用linux桌面或者服务器,有一些很好的工具能够帮你扫描系统中的重复文件并删除它们来释放空间。图形界面和命令行界面的都有。重复文件是磁盘空间不必要的浪费。毕竟,如果你的确需要在不同的位置享有同一个文件,你可以使用软链接或者硬链接,这样就可以在磁盘的一个地方存储数据了。

<a target="_blank"></a>

不要担心fslint的图形化界面太复杂。默认情况下,它会自动选中duplicate窗格,并以你的家目录作为搜索路径。

要安装fslint,若像我这样运行的是ubuntu,这里是默认的命令:

<code>$ sudo apt-get install fslint</code>

这里还有针对其他发行版的安装命令:

debian:

<code>svn checkout http://fslint.googlecode.com/svn/trunk/ fslint-2.45</code>

<code>cd fslint-2.45</code>

<code>dpkg-buildpackage -i.svn -rfakeroot -tc</code>

<code>sudo dpkg -i ../fslint_2.45-1_all.deb</code>

fedora:

<code>sudo yum install fslint</code>

opensuse:

<code>[ -f /etc/mandrake-release ] &amp;&amp; pkg=rpm</code>

<code>[ -f /etc/suse-release ] &amp;&amp; pkg=packages</code>

<code>wget http://www.pixelbeat.org/fslint/fslint-2.42.tar.gz</code>

<code>sudo rpmbuild -ta fslint-2.42.tar.gz</code>

<code>sudo rpm -uvh /usr/src/$pkg/rpms/noarch/fslint-2.42-1.*.noarch.rpm</code>

对于其他发行版:

<code>wget http://www.pixelbeat.org/fslint/fslint-2.44.tar.gz</code>

<code>tar -xzf fslint-2.44.tar.gz</code>

<code>cd fslint-2.44</code>

<code>(cd po &amp;&amp; make)</code>

<code>./fslint-gui</code>

要在ubuntu中运行fslint的gui版本fslint-gui, 使用alt+f2运行命令或者在终端输入:

<code>$ fslint-gui</code>

默认情况下,它会自动选中duplicate窗格,并以你的家目录作为搜索路径。你要做的就是点击find按钮,fslint会自动在你的家目录下找出重复文件列表。

如何在Linux上找出并删除重复的文件:FSlint如何在Linux上找出并删除重复的文件:FSlint

delete duplicate files with fslint

点击按钮来删除任何你要删除的文件,并且可以双击预览。

完成这一切后,我们就成功地删除你系统中的重复文件了。

注意 ,命令行工具默认不在环境的路径中,你不能像典型的命令那样运行它。在ubuntu中,你可以在/usr/share/fslint/fslint下找到它。因此,如果你要在一个单独的目录运行fslint完整扫描,下面是ubuntu中的运行命令:

<code>cd /usr/share/fslint/fslint</code>

<code></code>

<code>./fslint /path/to/directory</code>

这个命令实际上并不会删除任何文件。它只会打印出重复文件的列表-你需要自己做接下来的事。

<code>$ /usr/share/fslint/fslint/findup --help</code>

<code>find duplicate files.</code>

<code>usage: findup [[[-t [-m|-d]] | [--summary]] [-r] [-f] paths(s) ...]</code>

<code>if no path(s) specified then the current directory is assumed.</code>

<code>when -m is specified any found duplicates will be merged (using hardlinks).</code>

<code>when -d is specified any found duplicates will be deleted (leaving just 1).</code>

<code>when -t is specfied, only report what -m or -d would do.</code>

<code>when --summary is specified change output format to include file sizes.</code>

<code>you can also pipe this summary format to /usr/share/fslint/fslint/fstool/dupwaste</code>

<code>to get a total of the wastage due to duplicates.</code>

如何在Linux上找出并删除重复的文件:FSlint如何在Linux上找出并删除重复的文件:FSlint

fslint help

原文发布时间:2015-03-30

本文来自云栖合作伙伴“linux中国”

继续阅读