Ubuntu之dpkg命令介绍
安装deb软件包
1 | dpkg -i 安装包名称.deb |
dpkg常用命令
1 2 3 4 5 6 7 | sudo dpkg -I 文件名.deb //查看iptux.deb软件包的详细信息,包括软件名称、版本以及大小等(其中-I等价于--info) sudo dpkg -c 文件名.deb //查看iptux.deb软件包中包含的文件结构(其中-c等价于--contents) sudo dpkg -i 文件名.deb //安装iptux.deb软件包(其中-i等价于--install) sudo dpkg -l 文件名 //查看iptux软件包的信息(软件名称可通过dpkg -I命令查看,其中-l等价于--list) sudo dpkg -L 文件名 //查看iptux软件包安装的所有文件(软件名称可通过dpkg -I命令查看,其中-L等价于--listfiles) sudo dpkg -s 文件名 //查看iptux软件包的详细信息(软件名称可通过dpkg -I命令查看,其中-s等价于--status) sudo dpkg -r 文件名 //卸载iptux软件包(软件名称可通过dpkg -I命令查看,其中-r等价于--remove) |
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | root@lhrubuntu2004:/# apt list --installed | grep sun WARNING: apt does not have a stable CLI interface. Use with caution in scripts. sunloginclient/now 11.0.1.44968 amd64 [installed,local] root@lhrubuntu2004:/# dpkg-query -l | grep sun ii sunloginclient 11.0.1.44968 amd64 SunloginClient-11.0.1.44968 for Linux root@lhrubuntu2004:/# dpkg -l sunloginclient 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 sunloginclient 11.0.1.44968 amd64 SunloginClient-11.0.1.44968 for Linux root@lhrubuntu2004:/# dpkg -L sunloginclient /. /usr /usr/share /usr/share/applications /usr/share/applications/sunlogin.desktop /usr/local /usr/local/sunlogin /usr/local/sunlogin/etc /usr/local/sunlogin/scripts /usr/local/sunlogin/scripts/personal /usr/local/sunlogin/scripts/runsunloginclient.conf /usr/local/sunlogin/scripts/sunhost.sh /usr/local/sunlogin/scripts/checksun.sh /usr/local/sunlogin/scripts/host /usr/local/sunlogin/scripts/stop.sh /usr/local/sunlogin/scripts/common.sh /usr/local/sunlogin/scripts/depends.sh /usr/local/sunlogin/scripts/lightdm.conf /usr/local/sunlogin/scripts/runsunloginclient.service /usr/local/sunlogin/scripts/uninstall.sh /usr/local/sunlogin/scripts/start.sh /usr/local/sunlogin/scripts/init_runsunloginclient /usr/local/sunlogin/res /usr/local/sunlogin/res/font /usr/local/sunlogin/res/font/wqy-zenhei.ttc /usr/local/sunlogin/res/icon /usr/local/sunlogin/res/icon/online.ico /usr/local/sunlogin/res/icon/offline.ico /usr/local/sunlogin/res/icon/sunlogin_client.png /usr/local/sunlogin/res/icon/online_lock.ico /usr/local/sunlogin/res/icon/offline_lock.ico /usr/local/sunlogin/res/icon/online_ctrl.ico /usr/local/sunlogin/res/skin /usr/local/sunlogin/res/skin/remotecmd.skin /usr/local/sunlogin/res/skin/remotecamera.skin /usr/local/sunlogin/res/skin/skin.skin /usr/local/sunlogin/res/skin/remotefile.skin /usr/local/sunlogin/res/skin/desktopcontrol.skin /usr/local/sunlogin/bin /usr/local/sunlogin/bin/sunloginclient /usr/local/sunlogin/bin/oray_rundaemon /usr/local/sunlogin/bin/sunloginclient_desktop root@lhrubuntu2004:/# root@lhrubuntu2004:/# dpkg -s sunloginclient Package: sunloginclient Status: install ok installed Priority: extra Section: Internet Installed-Size: 38100 Maintainer: Oray <dev@oray.com> Architecture: amd64 Version: 11.0.1.44968 Depends: libappindicator3-1 Recommends: libwebkit2gtk-4.0.37, libwebkitgtk-3.0-0 Description: SunloginClient-11.0.1.44968 for Linux Sunlogin Remote Control is a software that supports remote control of mobile devices, Windows, Mac, Linux and other systems. It is the best choice for IT technology, game players, designers and other people with remote management needs. By using Sunlogin, you can control other computers or mobile phones anytime, anywhere. You can make things feasible, including remote high-risk operations, remote power on/off, download files, AFK, and so on. Download Sunlogin and explore more exciting features! HomePage: https://www.oray.com |
列出系统中已经安装了的软件包
1 2 | apt list --installed dpkg-query -l |
查找某个文件或者命令属于哪个软件包
如何使用apt-file在Debian/Ubuntu上进行软件包搜索
您需要安装apt-file命令,这是用于在APT软件包管理系统的软件包中搜索文件的命令行工具:
1 2 | $ sudo apt-get install apt-file $ sudo apt-file update |
要搜索文件包含在哪个软件包中,请输入:
1 2 | $ apt-file search date $ apt-file search kvm-ok |
输出示例:
1 2 | cpu-checker: /usr/sbin/kvm-ok cpu-checker: /usr/share/man/man1/kvm-ok.1.gz |
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | root@lhrubuntu2004:/# apt-file search whereis erlang-src: /usr/lib/erlang/lib/erl_interface-3.13.1/src/legacy/global_whereis.c git-annex: /usr/share/doc/git-annex/html/git-annex-whereis.html git-annex: /usr/share/man/man1/git-annex-whereis.1.gz manpages-de: /usr/share/man/de/man1/whereis.1.gz manpages-es-extra: /usr/share/man/es/man1/whereis.1.gz manpages-fr-extra: /usr/share/man/fr/man1/whereis.1.gz manpages-hu: /usr/share/man/hu/man1/whereis.1.gz manpages-ja: /usr/share/man/ja/man1/whereis.1.gz manpages-pl: /usr/share/man/pl/man1/whereis.1.gz openafs-client: /usr/share/man/man1/fs_whereis.1.gz scilab-test: /usr/share/scilab/modules/functions/tests/unit_tests/whereis.tst util-linux: /usr/bin/whereis util-linux: /usr/share/bash-completion/completions/whereis util-linux: /usr/share/man/man1/whereis.1.gz zsh-common: /usr/share/zsh/functions/Completion/Unix/_whereis |
参考
Ubuntu技巧参考:http://wiki.ubuntu.org.cn/UbuntuSkills