当前位置:首页 > Linux > 正文

linux如何查看已装软件

Linux中,可通过 dpkg -l(Debian系)或`rpm -qa

Linux 系统中,有多种方法可以查看已安装的软件,以下是一些常用的方法和命令:

使用 dpkg 命令(适用于 Debian 和 Ubuntu 系列)

dpkg 是 Debian 系列发行版中的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    dpkg --list

    这个命令会显示所有已安装的软件包及其版本、架构等信息,输出结果类似如下:

    Desire=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-old/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
    ||/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name           Version      Architecture    Description
    +++-==================-==========-==============---------------------------------------------------
    un   accountsservice 0.6.55       amd64          query and manipulate user account information
    in   adduser        3.118ubuntu2 all            add and remove users and groups
    in   apache2        2.4.48-1ubuntu2 amd64        Apache HTTP Server
  • 查找特定软件包是否已安装

    dpkg -l | grep <软件包名称>

    查找是否安装了 nginx

    dpkg -l | grep nginx

使用 apt 命令(适用于 Debian 和 Ubuntu 系列)

apt 是 Debian 系列发行版的高级包管理工具,提供了更友好的界面来管理软件包。

  • 列出所有已安装的软件包

    apt list --installed

    这个命令会显示所有已安装的软件包及其版本信息,输出结果类似如下:

    Listing... Done
    accountsservice/now 0.6.55 amd64 [installed,local]
    adduser/now 3.118ubuntu2 all [installed,local]
    apache2/now 2.4.48-1ubuntu2 amd64 [installed,local]
  • 查找特定软件包是否已安装

    apt list --installed | grep <软件包名称>

    查找是否安装了 nginx

    apt list --installed | grep nginx

使用 rpm 命令(适用于 Red Hat、CentOS、Fedora 等系列)

rpm 是 Red Hat 系列发行版中的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    rpm -qa

    这个命令会显示所有已安装的软件包及其版本、发布信息,输出结果类似如下:

    accountsservice-0.6.55-1.el7.x86_64
    adduser-3.118-1.el7.x86_64
    httpd-2.4.6-90.el7.centos.x86_64
  • 查找特定软件包是否已安装

    rpm -qa | grep <软件包名称>

    查找是否安装了 nginx

    linux如何查看已装软件  第1张

    rpm -qa | grep nginx

使用 yumdnf 命令(适用于 Red Hat、CentOS、Fedora 等系列)

yumdnf 是 Red Hat 系列发行版的包管理工具,dnfyum 的替代品,功能更强大。

  • 列出所有已安装的软件包

    yum list installed

    或者使用 dnf

    dnf list installed

    这个命令会显示所有已安装的软件包及其版本信息,输出结果类似如下:

    Installed Packages
    accountsservice.x86_64    0.6.55-1.el7          @base
    adduser.x86_64           3.118-1.el7           @base
    httpd.x86_64             2.4.6-90.el7.centos   @base
  • 查找特定软件包是否已安装

    yum list installed | grep <软件包名称>

    或者使用 dnf

    dnf list installed | grep <软件包名称>

    查找是否安装了 nginx

    yum list installed | grep nginx

使用 pacman 命令(适用于 Arch Linux 系列)

pacman 是 Arch Linux 系列的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    pacman -Q

    这个命令会显示所有已安装的软件包及其版本信息,输出结果类似如下:

    account-manager-base 0.6.55-1
    adduser            3.118-1
    httpd              2.4.48-1
  • 查找特定软件包是否已安装

    pacman -Q | grep <软件包名称>

    查找是否安装了 nginx

    pacman -Q | grep nginx

使用 snap 命令(适用于支持 Snappy 的发行版)

snap 是一种通用的软件包格式,适用于多种 Linux 发行版。

  • 列出所有已安装的 Snap 软件包

    snap list

    这个命令会显示所有已安装的 Snap 软件包及其版本信息,输出结果类似如下:

    Name    Version    Rev    Tracking       Publisher     Notes
    core    16-2.57.1  11084  stable        canonical    core
    chromium   95.0.4638.54   1551    stable       canonical    -
  • 查找特定软件包是否已安装

    snap list | grep <软件包名称>

    查找是否安装了 nginx

    snap list | grep nginx

使用图形化界面(适用于大多数 Linux 发行版)

大多数 Linux 发行版都提供了图形化的包管理工具,用户可以通过这些工具查看已安装的软件包。

  • Ubuntu/Debian:使用 SoftwareSynaptic 包管理器。
  • Red Hat/CentOS:使用 GNOME SoftwareYUM Extensible (yum-utils)。
  • Arch Linux:使用 PakkurYaourt
  • openSUSE:使用 ZypperYaST

通过这些图形化工具,用户可以直观地查看已安装的软件包,并进行搜索、过滤等操作。

使用 zypper 命令(适用于 openSUSE)

zypper 是 openSUSE 的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    zypper search --installed-only

    这个命令会显示所有已安装的软件包及其版本信息,输出结果类似如下:

    S | Name               | Type    | Version        | Arch    | Reposity                                | State
    -----+-----------------+---------+---------------+---------+----------------------------------------+---------
      1 | accountsservice    | package | 0.6.55-1.1    | x86_64 | openSUSE-Leap-15.2-Updates:openSUSE-Leap-15.2-Updates | installed(eq)
      2 | adduser            | package | 3.118-1.1     | x86_64 | openSUSE-Leap-15.2-Updates:openSUSE-Leap-15.2-Updates | installed(eq)
      3 | httpd              | package | 2.4.48-1.1    | x86_64 | openSUSE-Leap-15.2-Updates:openSUSE-Leap-15.2-Updates | installed(eq)
  • 查找特定软件包是否已安装

    zypper search --installed-only | grep <软件包名称>

    查找是否安装了 nginx

    zypper search --installed-only | grep nginx

使用 emerge 命令(适用于 Gentoo)

emerge 是 Gentoo Linux 的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    emerge --pretend --verbose =world

    这个命令会模拟安装所有已安装的软件包,并显示它们的详细信息,输出结果可能较长,但可以提供完整的已安装软件列表。

  • 查找特定软件包是否已安装

    emerge --pretend --verbose =<软件包名称>

    这个命令会模拟安装指定的软件包,如果该软件包已安装,则会显示相关信息,查找是否安装了 nginx

    emerge --pretend --verbose =nginx

使用 slackpkg 命令(适用于 Slackware)

slackpkg 是 Slackware Linux 的包管理工具,可以用来查询已安装的软件包。

  • 列出所有已安装的软件包

    slackpkg list installed

    这个命令会显示所有已安装的软件包及其版本信息,输出结果类似如下:

    
    Available packages in the 'installed' set:
      Name           Version       Arch   Repository   Category
      accountsservice   0.6.55       x86_64   Official     System tools and daemons for managing user accounts and login policy on Linux systems. This is a common replacement for /lib/lsb/init-functions and friends. It provides a DBus interface to dynamically start and stop services at boot time, and can be used to implement most of the traditional initscript functionality without requiring any scripting or configuration files. The service manager also handles mounting and unmounting of filesystems, starting and stopping of network interfaces, and other system events. The package includes a command line tool for interacting with the service manager, as well as a library for accessing its functionality from within other programs. The package also includes a number of helper utilities for working with user accounts and groups, such as adduser, deluser, and passwd. Finally, the package includes a number of sample scripts that can be used to implement common system administration tasks, such as backing up and restoring user accounts, synchronizing passwords between machines, and more. The package is designed to be as lightweight as possible, while still providing all of the functionality needed by modern desktop and server environments. It uses a minimal amount of memory and CPU resources, making it ideal for embedded systems and other resource-constrained environments. The package is also highly modular, allowing administrators to pick and choose which components they want to include in their installations. This makes it easy to customize the system to meet specific needs without having to recompile anything from scratch. In addition, the package is fully compatible with both SysV init scripts and Upstart jobs, so it can be used on any modern Linux distribution without requiring any modifications to existing configuration files or scripts. Overall, this package provides a robust and flexible solution for managing user accounts and login policy on Linux systems, while minimizing overhead and maximizing compatibility with existing tools and workflows. (Depends on dbus) [installed] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~] [~
0