GO KALI FREE
Package Management

dpkg -r Linux Command

Removes an installed package (keeps config files).

What does dpkg -r do?

Removes an installed package (keeps config files).

Syntax

dpkg -r package_name

Practical example

sudo dpkg -r google-chrome-stable

Questions about dpkg -r

How do I uninstall a package with dpkg?

Use `sudo dpkg -r package_name` to remove a package while keeping its configuration files.

What is the difference between dpkg -r and dpkg -P?

`-r` removes the package but keeps config files. `-P` (purge) removes everything including configuration files.

How do I purge a package with dpkg?

Use `sudo dpkg -P package_name` to completely remove a package including all configuration files.

How do I see what files a package installed?

Use `dpkg -L package_name` to list all files installed by the package on your system.

How do I check if dpkg removed a package?

Use `dpkg -l | grep package_name` to check. The status will show as 'rc' (removed, config files remaining) after removal.

How do I remove all config files of a removed package?

Use `sudo dpkg --purge package_name` to remove the remaining config files after a normal removal.

How do I force remove a package?

Use `sudo dpkg --force-remove-reinstreq -r package_name` to force remove a broken package.

How do I remove multiple packages with dpkg?

Use `sudo dpkg -r package1 package2 package3` to remove multiple packages in one command.

Related Package Management

dpkg -i

Installs a .deb package file directly (does not resolve dependencies).

dpkg -l

Lists all installed packages with version and description.

apt list

Lists packages based on package names with options for installed/upgradeable.

snap install

Installs a snap package from the Snap Store.

apt show

Displays detailed information about a specific package.

pip install

Installs Python packages from the Python Package Index (PyPI).