


Use these commands to easily see what packages are installed on your Linux PC
怎么列举Linux上已安装的软件包
使用这种命令可以轻松查看LinuxPC上安装了什么软件包。
在安装新软件包之前,您须要检测它是否已安装在您的系统上。据悉,假若您要转移到新系统,拥有所有已安装软件包的列表可以节约大量时间和精力。它还可以帮助您辨识想要删掉的不须要的软件包以释放一些空间。
以下是怎样列举各类Linux发行版(包括Ubuntu、Debian、CentOS、ArchLinux和openSUSE)上所有已安装的软件包的方式。
列举Ubuntu/Debian上已安装的软件包
在基于Debian的发行版上,您可以使用APT包管理器来查找、安装、更新和删掉包。使用APT,您还可以列举Debian/Ubuntu上所有已安装的程序及其版本和一些其他信息。
要列举基于Debian的发行版上所有已安装的软件包,请使用以下命令:
apt list --installed
该列表显示带有[installed]、[installed,automatic]和[installed,local]标签的不同软件包。
您还可以使用grep命令从已安装的程序列表中搜索程序,如下所示:
apt list --installed | grep program_name
您还可以使用dpkg实用程序列举已安装的软件包:
dpkg -l
要仅复印已安装软件包的名称,请结合使用dpkg命令和awk,如下所示:
dpkg -l | awk '{print $2}'
查看基于RHEL的发行版上已安装的软件包
YUM和DNF用于管理基于RHEL的发行版中的包。使用它们,您可以在PC上安装、更新、列出和删掉软件包
尽管YUM不再在较新的发行版(比如RHEL8、CentOS8、Fedora22等)中使用,但它依然可以在大多数发行版中使用。RPM还容许您安装和管理本地RPM软件包。
要使用YUM列举基于RHEL的发行版上所有已安装的软件包,请使用:
yum list installed
对于使用DNF安装的软件包,请使用:
dnf list installed
您还可以使用以下rpm命令列举基于RHEL的发行版上已安装的软件包:
rpm -qa
上述命令的--last选项列举了所有近来安装的软件包,最新的软件包坐落底部:
rpm -qa --last
此命令还列举已安装包的日期和时间以及包的名称:
rpm -qa --last | tac
列举ArchLinux上已安装的软件包
Pacman是基于Arch的Linux发行版(比如Manjaro和EndeavourOS)上的默认包管理器。使用Pacman,您可以在基于Arch的发行版中安装和删掉软件包、更新过时的软件包以及查看所有已安装软件包的列表。
以下命令用于列举基于Arch的发行版上所有已安装的软件包:
pacman -Q
要列举所有显式安装的软件包,请使用:
pacman -Qe
要列举从main之外的储存库自动安装的所有外部软件包linux服务器系统,请使用:
pacman -Qm
倘若您要在已安装的软件包列表中查找特定的软件包,请使用:
pacman -Q | grep
列举openSUSE上已安装的软件包
Zypper是openSUSE中默认的命令行包管理器。要列举openSUSE上所有已安装的软件包,请使用以下命令之一:
zypper search --installed-only
或则:
zypper se -i
要检测特定包是否在已安装的包列表中,请使用以下句型:
zypper se -i
您还可以使用以下命令复印有关已安装软件包的信息:
zypper info
查看Linux上已安装的Snap软件包
不仅传统的外置包管理器之外,还有一些程序可以通过Snap安装在Linux系统上。
Snap是所有主要Linux发行版都支持的通用包管理器。因为Snap软件包及其依赖项一起提供,因而Linux上的软件安装显得愈发容易。
要列举任何Linux发行版上已安装的Snap软件包,请运行:
snap list
此命令列举您已使用Snap安装的软件包。它不包括您使用默认包管理器安装的任何包。
不仅已安装的软件包名称之外,该列表还包含一些其他信息,比如软件包的版本号、修订号、渠道信息、发布者名称以及任何其他信息(假如有)。
列举已安装的Flatpak软件包
与Snap类似,Flatpak也是一个在Linux上更轻松地进行包管理的工具。您可以在所有主要Linux发行版上安装Flatpak,而且可以使用它在Linux上建立、安装和运行应用程序。
要列举Flatpak已安装的软件包,请使用以下命令:
flatpak list
此命令列举Linux系统上所有安装的Flatpak软件包和运行时。运行时是应用程序运行所需的一组依赖项。
要仅列举已安装的应用程序,请使用--app选项,如下所示:
flatpak list --app
同样,要仅列举已安装的运行时,请使用--runtime选项:
flatpak list --runtime
要查看有关所列项目的详尽信息,比如已安装的应用程序大小、体系结构、来源等如何查看linux是什么系统,请使用-d选项:
flatpak list -d
您还可以跳过所有额外信息,仅使用以下命令复印已安装应用程序的名称:
flatpak --columns=name list
将已安装程序的列表保存在文件中
要将所有已安装程序的列表保存在文件中,请使用重定向运算符(>)后跟文件名嵌入式linux培训,将命令输出重定向到文件。
比如,要将APT安装程序的列表保存在名为installed_programs.txt的文本文件中,命令为:
apt list --installed > installed_programs.txt
估算已安装的软件包数目
您还可以使用wc命令估算列表中已安装软件包的数目。比如如何查看linux是什么系统,要统计openSUSE中Zypper安装的软件包数目,命令为:
zypper search --installed-only | wc -l
您已获得所有已安装Linux软件包的列表!
如今您晓得Linux系统上安装了什么软件包,您可以轻松更新过时的软件包或通过删掉不须要的软件包来清理一些空间。
据悉,拥有此程序列表还可以促使无缝过渡到新系统,使您可以安装所有这种程序,而无需单独记住它们。
The above is the detailed content of Use these commands to easily see what packages are installed on your Linux PC. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.
