To extract the contents of a .deb
file without opening it on Debian or Ubuntu Linux, you can use the dpkg
command with the -x
option. The syntax is as follows:
dpkg -x package.deb destination
Replace package.deb
with the name of the .deb
file, and destination
with the directory where you want to extract the contents of the file.
For example, to extract the contents of a file called mypackage.deb
to the /tmp
directory, you would run the following command:
dpkg -x mypackage.deb /tmp
This will extract all of the files contained in the .deb
file to the /tmp
directory.
If you want to extract only a specific file from the .deb
file, you can use the -X
option followed by the path of the file you want to extract. The syntax is as follows:
dpkg -X package.deb path/to/file destination
For example, to extract a file called README.txt
from the mypackage.deb
file to the current directory, you would run the following command:
dpkg -X mypackage.deb usr/share/doc/mypackage/README.txt .
This will extract the README.txt
file from the mypackage.deb
file to the current directory.
Keep in mind that the dpkg
command is used to manage packages on Debian and Ubuntu systems, and it is not intended for extracting individual files from .deb
files. If you just want to extract the contents of a .deb
file, you can use a tool like ar
or bsdtar
.