linux查看软件是否安装


1 temp=`dpkg -l | grep "openssl"
2 if [ -n "$temp" ];then
3     echo "openssl已经安装"
4 elif [ -z "$temp" ];then
5     echo "openssl未安装"
6 fi

1. rpm包安装的

    rpm -qa | grep "软件包名称“

2.deb包安装的

    dpkg -l | grep "软件包名称"

3.yum安装的

    yum list installed | grep "软件包名称"

4.如果是以源码包自己编译安装的,例如:tar.gz或者tar.bz2,这个只能检测可执行文件是否存在了。

如果是以root用户安装的通常是在/sbin:/usr/bin目录下

 

######################################

temp=`/bin/ls *.conf 2>/dev/null`
for c in $temp; do
if [ -f $c ];then
    echo $c
fi
done

循环显示以.conf结尾的文件名

2>/dev/null 错误重定向到/dev/null

#######################################


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM