# man > debclean(1)

---
type: CommandReference
command: debclean
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `debclean` — clean all Debian source trees under current directory
- `debclean --cleandebs` — also remove .deb, .changes, .build files
- `debclean --check-dirname-level 2` — always check directory name matches package
- `debclean --check-dirname-regex 'PACKAGE'` — use custom regex for directory name check
- `debclean --no-conf` — ignore configuration files
- `debclean --help` — display help message
- `debclean --version` — display version information

## Name

`debclean` — clean up a sourcecode tree

## Synopsis

`debclean` [options]

## Options

### Cleaning options

- `--cleandebs` — remove all `.deb`, `.changes` and `.build` files from parent directory
- `--nocleandebs` — do not remove those files (default)

### Directory name checking options

- `--check-dirname-level N` — set checking level: 0 (never), 1 (only if changed directory, default), 2 (always)
- `--check-dirname-regex regex` — Perl regex to match directory name; `PACKAGE` is replaced by source package name; default: `PACKAGE(-.+)?`

### General options

- `-d` — (no description provided)
- `--help` — display help and exit successfully
- `--version` — display version and copyright information and exit successfully
- `--no-conf`, `--noconf` — do not read any configuration files (must be first option)

### Configuration variables

Configuration files `/etc/devscripts.conf` and `~/.devscripts` are sourced in order. Recognized variables:

- `DEBCLEAN_CLEANDEBS` — set to `yes` to enable `--cleandebs` behaviour
- `DEVSCRIPTS_CHECK_DIRNAME_LEVEL` — same as `--check-dirname-level`
- `DEVSCRIPTS_CHECK_DIRNAME_REGEX` — same as `--check-dirname-regex`

## Examples

shell
# Clean all Debian source trees under the current directory
debclean

# Clean and also remove .deb, .changes, .build files
debclean --cleandebs

# Always check directory name matches package name
debclean --check-dirname-level 2

# Use a custom regex for directory name checking
debclean --check-dirname-regex 'PACKAGE-.*'
## See Also

- [debuild(1)](https://manpages.debian.org/debuild.1)
- [devscripts.conf(5)](https://manpages.debian.org/devscripts.conf.5)
- [perlre(3perl)](https://manpages.debian.org/perlre.3perl)
- [pwd(1)](https://manpages.debian.org/pwd.1)