[运维] Ubuntu系统判断某个软件是否安装

场景: 某个命令找不到(不要直接apt install)

  1. 使用locate命令查找命令
locate gfortran
/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/pgfortran
/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/man/cat1/pgfortran.1
/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/man/man1/pgfortran.1
/usr/bin/gfortran-10
/usr/bin/x86_64-linux-gnu-gfortran-10
/usr/lib/gcc/x86_64-linux-gnu/10/libgfortran.a
/usr/lib/gcc/x86_64-linux-gnu/10/libgfortran.so
/usr/lib/gcc/x86_64-linux-gnu/10/libgfortran.spec
/usr/lib/x86_64-linux-gnu/libgfortran.so.5
/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0
/usr/share/bash-completion/completions/gfortran
/usr/share/bash-completion/completions/gfortran-5
/usr/share/bash-completion/completions/gfortran-6
/usr/share/bash-completion/completions/gfortran-7
/usr/share/bash-completion/completions/gfortran-8
/usr/share/doc/gfortran-10
/usr/share/doc/libgfortran-10-dev
/usr/share/doc/libgfortran5
/usr/share/lintian/overrides/gfortran-10
/usr/share/man/man1/gfortran-10.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gfortran-10.1.gz
/usr/share/vim/vim81/compiler/gfortran.vim
/var/cache/apt/archives/gfortran-10_10.5.0-1ubuntu1~20.04_amd64.deb
/var/cache/apt/archives/libgfortran-10-dev_10.5.0-1ubuntu1~20.04_amd64.deb
/var/cache/apt/archives/libgfortran5_10.5.0-1ubuntu1~20.04_amd64.deb
/var/lib/dpkg/info/gfortran-10.list
/var/lib/dpkg/info/gfortran-10.md5sums
/var/lib/dpkg/info/libgfortran-10-dev:amd64.list
/var/lib/dpkg/info/libgfortran-10-dev:amd64.md5sums
/var/lib/dpkg/info/libgfortran5:amd64.list
/var/lib/dpkg/info/libgfortran5:amd64.md5sums
/var/lib/dpkg/info/libgfortran5:amd64.shlibs
/var/lib/dpkg/info/libgfortran5:amd64.symbols
/var/lib/dpkg/info/libgfortran5:amd64.triggers

  1. 找到 /var/lib/dpkg/info/gfortran-10.list 这种list后缀的文件
  2. 删除时:dpkg 会读取 .list 文件中列出的所有文件,以确保删除了所有与该软件包相关的文件。
  3. 更新时:系统可以对比文件列表,决定哪些文件需要更新。
  4. 检查时:用户可以查看某个包安装了哪些文件以及它们的位置
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值