Clean up your filesystem with FSlint

Spring Cleaning


Over time, a filesystem starts to look cluttered. FSlint helps you keep your system looking good.

By Erik Bärwaldt

Dmitry Remesov, 123rf

If you use your computer intensively, filesystem inconsistencies creep in over time. A tool called FSlint quickly and reliably discovers problems such as bad symbolic links, duplicate filenames, empty directories, and unused directory blocks. As a nice side effect, FSlint also gets rid of ballast and frees up disk space.

Work on FSlint has made continuous progress, and the program is included with many Linux distributions. Packages for the current versions of Ubuntu and other Debian-based systems, as well as Fedora, Red Hat, openSUSE, and Mandriva, are available from the FSlint homepage [1]. If you use a legacy version of Fedora, Red Hat, or CentOS, you can download the packages from Dag Wieërs' repository [2]. OpenSUSE also has prebuilt packages up for grabs on the web [3] for both manual and one-click installation.

On Gnome, the installation routine creates a launcher in the Applications | System tools menu. FSlint comes up with a tidy GUI that is easy to use, even if you have never seen a filesystem cleaning tool before, eliminating the need for comprehensive documentation.

In the program window on the left are large icons that branch off to individual functions; you can define various search paths in the main panel. The central part shows to which files or directories a selected function applies. In the bottom right is an overview of the directories the application has not checked because it lacks the necessary permissions.

Clean-up Work

The tool's main focus is to discover and remove superfluous files, such as duplicates, temporary files no longer needed, or empty directories. FSlint finds duplicates, or multiple instances of files, that often occur in large collections of music. To define a search path, click the Add button and select a directory to match. You can specify multiple directories in a single step; FSlint works its way through them one after another.

Checking the Recurse? box enables searching in subdirectories. Now press the Duplicates button on the left, and then select Find below the main panel on the left to tell FSlint to start searching for duplicate files or multiple instances of files.

Depending on the paths you define and how much data you have, the search can take some time to complete. Because you will typically run the search as a normal user rather than root, the list of directories the software was unable to process for lack of permission will tend to build up in the bottom panel (see Figure 1).

Figure 1: FSlint puts an end to duplicate files.

At the end of the search, click the Select button in the central panel, and then use the arrow keys to navigate to the files you want to delete. Clicking the Delete button then removes the selected files; as an alternative, you can merge the files or store them at a different location.

A Word of Caution!

If the duplicates you find happen to be system files you didn't install yourself, use caution before you decide to delete. And you should be generally cautious when deleting temporary files or empty directories. In most cases, it is a good idea to delete less rather than more. Some applications need certain directories and check whether these files exist when they launch. If the directories are missing, the application might refuse to run.

Deleting system files could even prevent your computer from booting in the worst case, or you might experience unexpected hardware problems. You should only manually delete files and directories if you are quite certain the files you are removing are duplicates. Because of the large number of potential alternative configurations and the resulting dependencies, FSlint can't provide a generically reliable aid for identifying system-critical files (Figure 2).

Figure 2: You can't just delete every empty directory.

Another special case that becomes more aggravated the more you use a computer is the problem of broken symbolic links for individual files. FSlint tracks them down and removes them reliably. Although this will not free up much space, it is always a good idea to remove broken links to keep your filesystem clean.

Character Set Chaos

Especially if you work in a heterogeneous environment in which you run Linux and other operating systems, an exchange of data between these systems can lead to incompatibilities that are often due to non-standards-compliant character sets.

Linux itself uses either UTF-8 or another, typically country-specific, character set that complies with an international ISO standard. Other operating systems might use non-standardized character sets that cause issues. In the worst case, Linux might not be able to open files whose names contain incompatible characters. In some cases the system will highlight non-standards-compliant filenames for you to change them.

If you download multimedia files frequently off the Internet or from other computers, you will want to run FSlint against the directories in which you store these files to identify problematic filenames. To do so, click the Bad names button on the left. Renaming the files discovered by this search will give you standards-compliant names.

To avoid filling the list with a huge number of insignificant infringements, use the slider in the main window to adjust the search intensity. A setting that only alerts on major infringements against file naming conventions will typically be fine.

Conclusions

FSlint is a powerful tool for cleaning up your filesystem and freeing up wasted storage space quickly and easily. The intuitive interface and the avoidance of functional overkill in the menus mean that any newcomer will feel at home with the software right from the start.

FSlint can't protect incautious users against causing serious damage. Because FSlint is unable to tell whether or not the files and directories it finds are system critical, unconsidered deletion can lead to an unusable system. A cautious approach is recommended; after all, more is not always better.

INFO
[1] FSlint: http://www.pixelbeat.org/fslint/
[2] FSlint packages: http://dag.wieers.com/rpm/packages/fslint/
[3] openSUSE packages: http://software.opensuse.org/search/?q=fslint