dh_clean - Linux


dh_clean removes all intermediate files created by Debian packaging operations, including file lists, debian or debsrc/ directories, ".debhelper" directories, and temporary archives. It also purges the system of temporary files and partially downloaded packages.


dh_clean [--rmdeps] [--rmconf] [--nocheck] [--buildsystem <system>] [--sourcedir <directory>] [--debdir <directory>] [--distribution <distribution>] [--build={auto,indep,dep}] [--noautoclean]


  • --rmdeps: Remove all dependency lists.
  • --rmconf: Remove the debian/ and debsrc/ directories (unless they are needed by a changelog).
  • --nocheck: Do not check for removed dependencies.
  • --buildsystem <system>: [Build systems only] Override the directory to be cleaned.
  • --sourcedir <directory>: [Source packages only] Override the directory where the source code is located.
  • --debdir <directory>: [Binary packages only] Override the directory where the DEB packages are located.
  • --distribution <distribution>: [Source packages only] Override the distribution.
  • --build={auto,indep,dep}: [Binary packages only] Specify the build type.
  • --noautoclean: Disable the automatic removal of debhelper directories.


  • Remove all intermediate files for the current Debian package:
  • Remove dependency lists and Debian directories, but keep the changelog:
dh_clean --rmdeps --rmconf
  • Clean a binary package built in a custom directory:
dh_clean --sourcedir /path/to/source/directory --debdir /path/to/binary/directory

Common Issues

  • Running dh_clean before building the package: This will not have any effect since there are no intermediate files to remove.


dh_clean can be used in conjunction with other Debian packaging tools:

  • dh_make: To clean up after a dh_make run.
  • pbuilder: To clean up temporary archives created by pbuilder.

Related Commands

  • dpkg
  • dpkg-deb
  • lintian