查看神奇目录/misc/cd下的安装包

自动挂载光盘
需安装autofs软件包,并启动服务进程
yum install -y autofs
systemctl enable --now autofs
/*
systemctl enable autofs
systemctl start autofs
*/
rpm包命名方式:
name-VERSION-release.arch.rpm
VERSION: major.minor.release
release:release.OS

ypbind-2.5-2.el8.x86_64.rpm
常见的arch:
x86: i386, i486, i586, i686
x86_64: x64, x86_64, amd64
powerpc: ppc
跟平台无关:noarch

统计rpm的架构类型及相应的包数量

[root@centos8 Packages ]#pwd
/misc/cd/AppStream/Packages

方式一:rev

[root@centos8 Packages ]#ll *.rpm | rev | cut -d. -f2 | rev | sort |uniq -c
    895 i686
   1953 noarch
   2478 x86_64

方式二:grep

[root@centos8 Packages ]#ll *.rpm | grep -Eo "[^.]+\.rpm$" | grep -Eo "^[^.]+" | sort  | uniq -c
    895 i686
   1953 noarch
   2478 x86_64
[root@centos8 Packages ]#ll *.rpm | grep -Eo "[^.]+\.rpm$" | cut -d. -f1 | sort |uniq -c
    895 i686
   1953 noarch
   2478 x86_64

方式三:sed

[root@centos8 Packages ]#ll *rpm | sed -nr "s/.*\.([^.]+)\.rpm$/\1/p" | sort | uniq -c
    895 i686
   1953 noarch
   2478 x86_64

方式四:awk

[root@centos8 Packages ]#ll *rpm | awk -F"." '{print $(NF-1)}' | sort | uniq -c
    895 i686
   1953 noarch
   2478 x86_64
[root@centos8 Packages ]#ll *rpm | awk -F. '{ip[$(NF-1)]++}END{for(i in ip){print ip[i],i}}'
2478 x86_64
895 i686
1953 noarch

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值