| lostfiles(1) | lostfiles(1) |
NAME
lostfiles - Find orphaned files not owned by any packages.
USAGE
lostfiles [-s] [-z] [-h]
DESCRIPTION
Lostfiles compares pacman's database of package owned files to the contents of actual filesystem and reports files that are not owned by a package. Useful for identifying non-native files. Must be run as root.
OPTIONS
-s
Run in strict mode which aims to be more verbose ignoring less.-z
Print and sort by size of matches.-h
Display usage information and exit.
USER-DEFINED EXCLUDES
lostfiles.conf can be customized with a list of paths to include and exclude when running in relaxed mode. Each line beginning with a plus (+) or minus (-) sign, followed by an absolute path, will respectively include or exclude that path from the results. Exclude paths are matched as shell-style globs: an asterisk (*) matches any string within a single path component, and a double asterisk (**) matches across directory separators. Excluding a directory prunes its entire subtree. Lines beginning with a number sign (#) are interpreted as comments. Any other line causes lostfiles to abort with an error, so that a malformed rule is never silently ignored.
lostfiles first looks for a lostfiles.conf next to the script itself; if that file is missing, or if it (or its containing directory) is not owned by root or the invoking sudo user, or is writable by group or other, it is ignored with a warning and lostfiles falls back to /etc/lostfiles.conf instead. This prevents a loosely-permissioned configuration file from being used to hide files from the report.
Additional configuration overrides can be placed in /etc/lostfiles.d/ as individual *.conf files. These drop-in files use the same format as /etc/lostfiles.conf and are read in lexical order after the main configuration file. This allows packages or local administrators to add custom include/exclude rules without modifying the main configuration file.
NOTES
File names containing a literal newline are dropped from the results and reported in a summary warning on stderr, rather than being printed, since a crafted file name could otherwise inject a spoofed line into the report.
lostfiles requires fd, pacman, and a handful of standard coreutils/base tools to be present; it refuses to run and lists whatever is missing rather than silently producing an incomplete report.
CONTRIBUTE
Users wishing to contribute to this code, should fork and send a pull request. Source is freely available at:
AUTHORS
Current maintainer:
- •
- graysky <therealgraysky AT proton DOT me>
Past major contributors:
- Joan Bruguera (joanbrugueram AT gmail DOT com)
- Mircea Bardac (dev AT mircea.bardac.net)
- Modified by Jan Janssen, graysky, karol, asdffdsa, iceram, and others.
| 12 July 2026 |