Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use dpkg command to manage software package in Linux system of Debian system

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the dpkg command to manage software packages in the Debian Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Dpkg means Debian package Manager (Debian PacKaGe manager). Dpkg is a command-line tool that installs, builds, removes, and manages Debian packages. Dpkg uses Aptitude (* and more user-friendly) as the front-end interface for performing all operations.

Other tools such as dpkg-deb and dpkg-query also use dpkg as a front end for performing certain operations.

Nowadays, most system administrators use tools such as Apt, Apt-Get, and Aptitude, so they can easily manage the software without bothering.

However, you still need to use dpkg to install some software if necessary. Other package management tools that are widely used on Linux systems are yum, dnf, apt-get, rpm, Zypper, pacman, urpmi and so on.

Now, I'm going to use some examples to illustrate the most commonly used dpkg commands on a machine with Ubuntu 15.10.

1) syntax of common dpkg commands and location of dpkg files

The following is the syntax of common dpkg commands and the location of dpkg-related files, which will certainly be of great benefit to you if you want to learn more about them.

# syntax of dpkg command $dpkg-[command] [.deb package name] $dpkg-[command] [package name] # location of dpkg related files $/ var/lib/dpkg # this file contains information about packages modified by dpkg commands (install, remove, etc.) $/ var/lib/dpkg/status # this file contains a list of available packages $/ var/lib/dpkg/status

2) install / upgrade softwar

On Debian-based systems such as Debian, Mint, Ubuntu, and elementryOS, use the following command to install / upgrade the .deb package. Here I'm going to install Atom with the atom-amd64.deb file. If Atom is already installed, it will be upgraded. Or a new Atom will be installed.

# install or upgrade dpkg package $sudo dpkg-I atom-amd64.deb Selecting previously unselected package atom. (Reading database... 426102 files and directories currently installed.) Preparing to unpack atom-amd64.deb... Unpacking atom (1.5.3) over (1.5.3)... Setting up atom (1.5.3). Processing triggers for gnome-menus (3.13.3-6ubuntu1). Processing triggers for bamfdaemon (0.5.2~bzr0+15.10.20150627.1-0ubuntu1)... Rebuilding / usr/share/applications/bamf-2.index... Processing triggers for desktop-file-utils (0.22-1ubuntu3). Processing triggers for mime-support (3.58ubuntu1)...

3) install the software from the folder

On Debian-based systems, install the software one by one from the directory with the following command. This installs all the software in the / opt/software directory with the suffix .deb.

$sudo dpkg-iR / opt/software Selecting previously unselected package atom. (Reading database... 423303 files and directories currently installed.) Preparing to unpack / opt/software/atom-amd64.deb... Unpacking atom (1.5.3). Setting up atom (1.5.3). Processing triggers for gnome-menus (3.13.3-6ubuntu1). Processing triggers for bamfdaemon (0.5.2~bzr0+15.10.20150627.1-0ubuntu1)... Rebuilding / usr/share/applications/bamf-2.index... Processing triggers for desktop-file-utils (0.22-1ubuntu3). Processing triggers for mime-support (3.58ubuntu1)...

4) display a list of installed software

The following command lists all installed software on Debian systems, and displays the software version and description information.

$dpkg-l Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend | / Err?= (none) / Reinst-required (Status) Err: uppercase=bad) | | / Name Version Architecture Description + +-=-=-- = ii account-plugin-aim 3.12.10-0ubuntu2 amd64 Messaging account plugin for AIM ii account-plugin-facebook 0.12 percent 15.10.20150723-0ubuntu1 all GNOME Control Center account plugin for single signon-facebook ii account-plugin-flickr 0.1215.10.20150723-0ubuntu1 all GNOME Control Center account plugin for single signon-flickr ii account-plugin-google 0.120.015.10.20150723-0ubuntu1 all GNOME Control Center account plugin for single signon ii account-plugin-jabber 3.12.10-0ubuntu2 amd64 Messaging account plugin for Jabber/XMPP ii account-plugin-salut 3.12.10-0ubuntu2 Amd64 Messaging account plugin for Local XMPP (Salut). .

5) View the specified installed software

Use the following command to list a specified installed software, along with the software version and description information.

$dpkg-l atom Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend | / Err?= (none) / Reinst-required (Status,Err: uppercase=bad) | | / Name Version Architecture Description + +-= ii atom 1.5.3 amd64 A hackable text editor for the 21st Century.

6) View the software installation directory

The following command can view the installation path of the software on Debian-based systems.

$dpkg-L atom /. / usr/ usr/bin/ usr/bin/atom / usr/share/ usr/share/lintian/ usr/share/lintian/overrides/ usr/share/lintian/overrides/atom / usr/share/pixmaps/ usr/share/pixmaps/atom.png / usr/share/doc

7) View the contents of the deb package

The following command allows you to view the contents of the deb package. It displays a series of files in the .deb package.

$dpkg-c atom-amd64.deb drwxr-xr-x root/root 0 2016-02-13 02:13. / drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/ drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/bin/-rwxr-xr-x root/root 3067 2016-02-13 02:13. / usr/bin/atom drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/share/ drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/share/lintian/ drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/share/lintian/overrides/-rw-r--r-- root/root 2016-02-13 02:13. / usr/share/lintian/overrides/atom drwxr-xr-x Root/root 0 2016-02-13 02:13. / usr/share/pixmaps/-rw-r--r-- root/root 643183 2016-02-13 02:13. / usr/share/pixmaps/atom.png drwxr-xr-x root/root 0 2016-02-13 02:13. / usr/share/doc/. .

8) display the details of the software

The following command displays the details of the software, such as software name, software category, version, maintainer, software architecture, dependent software, software description, and so on.

$dpkg-s atom Package: atom Status: install ok installed Priority: optional Section: devel Installed-Size: 213496 Maintainer: GitHub Architecture: amd64 Version: 1.5.3 Depends: git, gconf2, gconf-service, libgtk2.0-0, libudev0 | libudev1, libgcrypt11 | libgcrypt20, libnotify4, libxtst6, libnss3, python, gvfs-bin, xdg-utils, libcap2 Recommends: lsb-release Suggests: libgnome-keyring0, gir1.2-gnomekeyring-1.0 Description: A hackable text editor for the 21st Century. Atom is a free and open source text editor that is modern, approachable, and hackable to the core.

9) check which software the file belongs to

Use the following command to see which software the file belongs to.

$dpkg-S / usr/bin/atom atom: / usr/bin/atom

10) remove / remove software

The following command can be used to remove / delete an installed software without deleting the configuration file.

$sudo dpkg-r atom (Reading database... 426404 files and directories currently installed.) Removing atom (1.5.3). Processing triggers for gnome-menus (3.13.3-6ubuntu1). Processing triggers for bamfdaemon (0.5.2~bzr0+15.10.20150627.1-0ubuntu1)... Rebuilding / usr/share/applications/bamf-2.index... Processing triggers for desktop-file-utils (0.22-1ubuntu3). Processing triggers for mime-support (3.58ubuntu1)...

11) cleanup software

The following command can be used to remove / delete all files, including configuration files.

$sudo dpkg-P atom (Reading database... 426404 files and directories currently installed.) Removing atom (1.5.3). Processing triggers for gnome-menus (3.13.3-6ubuntu1). Processing triggers for bamfdaemon (0.5.2~bzr0+15.10.20150627.1-0ubuntu1)... Rebuilding / usr/share/applications/bamf-2.index... Processing triggers for desktop-file-utils (0.22-1ubuntu3). Processing triggers for mime-support (3.58ubuntu1)...

12) learn more

Use the following command to view more information about dpkg.

$dpkg-help or $man dpkg or above are all the contents of the article "how to use dpkg commands to manage software packages in Debian Linux systems". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report