Answers for "find if package is installed linux"

1

bash check if package is installed

REQUIRED_PKG="some-package"
PKG_OK=$(dpkg-query -W --showformat='${Status}n' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
if [ "" = "$PKG_OK" ]; then
  echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG."
  sudo apt-get --yes install $REQUIRED_PKG 
fi
Posted by: Guest on August-16-2021
-1

how to check installed packages in linux command

dpkg-query --list | grep -i nano
ii  nano    2.9.3-2    amd64    small, friendly text editor inspired by Pico
Posted by: Guest on June-24-2020

Code answers related to "find if package is installed linux"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language