dpkg-divert is a command-line utility that allows you to manage the diversion of Debian package files to another location. The command is used to create and manage a divert list in Debian Linux. The divert list is a record of files that have been diverted and their new locations. This command is essential when you need to modify files that are installed by a Debian package without modifying the package itself.
The syntax for using
dpkg-divert command is as follows:
dpkg-divert [option] [file]
option parameter specifies the action to be performed on the file, and the
file parameter specifies the file to be diverted.
Creating a Divert List
To create a new divert list, use the following command:
dpkg-divert --add [file]
This command will create a new entry in the divert list for the specified file.
Diverting a File
To divert a file, use the following command:
dpkg-divert --divert [new-file] [file]
This command will divert the specified file to the new location specified by
new-file. The original file will be replaced with a symlink to the new location.
Removing a Diversion
To remove a diversion, use the following command:
dpkg-divert --remove [file]
This command will remove the diversion for the specified file.
The following table lists the available options for the
|–add||Add a new diversion to the divert list.|
|–remove||Remove a diversion from the divert list.|
|–list||List all diversions in the divert list.|
|–list [file]||List all diversions for the specified file.|
|–divert [new-file] [file]||Divert the specified file to the new location specified by
|–rename [new-file] [file]||Rename the specified file to the new name specified by
|–truename [file]||Print the true name of the specified file.|
- If you encounter permission errors, make sure you have sufficient privileges to modify the files you are diverting.
- If you encounter issues with the package that you have diverted files from, try reinstalling the package to restore the original files.
dpkg-divertis a powerful tool that can modify the behavior of Debian packages. Use it with caution and make sure you understand the consequences of your actions.
- Diverted files may not be updated when the original package is updated. It is your responsibility to maintain the diverted files and update them when necessary.