TinkOL

  • 首页
TinkOL
好记性不如烂笔头!
  1. 首页
  2. Linux
  3. 正文

Linux查看软件包是否默认安装

2021年6月29日 1958点热度 1人点赞 0条评论

今天同事问我:CentOS里的ss这个命令是在系统安装时就装了的么?那Ubuntu下也默认安装了?

对CentOS,咱还是熟悉的,想知道是否在系统安装时就默认安装了,首先得先知道这个命令是在那个包里的。可以用这个命令进行查看。

[root@localhost ~]# rpm -qf `which ss`
iproute-4.11.0-25.el7_7.2.x86_64

可以得知,ss命令是在iproute包中,那下一个问题,就是查这个包是否在系统安装时就默认安装了。CentOS 的yum groups里有一个Minimal Install 软件包组,这个里面就是最小安装时使用到的软件了。

[root@localhost ~]# yum group info Minimal Install
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile

Environment Group: Minimal Install
 Environment-Id: minimal
 Description: Basic functionality.
 Mandatory Groups:
   +core
 Optional Groups:
   +debugging

[root@localhost ~]# yum group info core
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile

Group: Core
 Group-Id: core
 Description: Smallest possible installation.
 Mandatory Packages:
    audit
    basesystem
    bash
    ....
    initscripts
    iproute
    iprutils
    iptables
    ....

可以看出,iproute 包在core软件包组里,因此,ss命令是在系统安装时就默认给装上了。

再是Ubuntu,Ubuntu需要用apt-file工具进行查看,这个命令默认没有安装,需要用apt install apt-file 命令进行安装,安装后还需要更新下数据库,更新命令是apt-file update,数据库更新了就可以搜索了。

root@localhost:~# apt-file search /bin/ss
alsa-firmware-loaders: /usr/bin/sscape_ctl
dacs: /usr/bin/sslclient
....
embassy-domainatrix: /usr/bin/ssematch
hash-slinger: /usr/bin/sshfp
iproute2: /bin/ss
libnet-proxy-perl: /usr/bin/sslh
....

这个命令并不如rpm好用,首先得更新数据库,然后会列出所有符合搜索条件的结果(包括未安装的包里的文件,因此可以用这个命令来搜索只记得部分内容的软件包),因此搜索会比较慢。人工判断识别后得知Ubuntu里是在iproute2软件包中,再对比Ubuntu最小号安装列表(https://packages.ubuntu.com/bionic/ubuntu-minimal ),得知iproute2包是默认安装的包。

事后搜索了一番,Debian系其实也有类似rpm -qf的命令工具,使用dpkg -S whereis就可以直接得到结果了。这篇文章还整理了其他Linux发行版的命令,收藏以备查阅。

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: CentOS Ubuntu
最后更新:2021年6月29日

Tink

这个人很懒,什么都没留下

点赞

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

最新 热点 随机
最新 热点 随机
Linux查看软件包是否默认安装 iOS 15 初体验,IP隐藏功能测试,还有Private Relay 修复homebrew安装软件404问题 macOS在iterm2使用touch ID Python实现命令行单行倒计时 一个无语的mysql问题
升级MacMojave 后brew无法使用 黑科技解决MacOS App Store更新慢的问题 二〇二〇 聊聊MacBook Pro 修复homebrew安装软件404问题 Nginx fastcgi_cache 的坑
标签聚合
CentOS MacOS Mojave 分享 MacOS Wordpress iOS Ubuntu Apple
归档
  • 2021年6月
  • 2021年4月
  • 2020年9月
  • 2020年3月
  • 2020年2月
  • 2019年5月
  • 2019年4月
  • 2019年1月
  • 2018年10月
  • 2018年9月

COPYRIGHT © 2022 tinkol.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

浙ICP备15016634号-1