I need a bash line to check if a ubuntu package needs an upgrade or not.
For example, I want to check if the package 'firefox' needs an upgrade using dpkg or apt-get commands.
Hypthetical Example:
# Hypothetical example pseudo-code
if [[ $(firefox_needs_upgrade) ]]; then echo "Firefox needs upgrading";fi
From: https://unix.stackexchange.com/questions/19470/list-available-updates-but-do-not-install-them
You can check version of programs installed under apt with command:
You can check a current package by referencing the Ubuntu Packages Search. Alternatively, for any package under apt (assuming that you have the updates repository enabled), you can use the apt-get command to update your package information and check for upgrades:
If you are not logged in as root (which is generally to be avoided, you may have to use sudo to have sufficient privileges):
Check the apt-get man page for more options.
Finally, you can search (or subscribe to) Ubuntu security notices to keep yourself notified real-time of needed updates.
The command your looking for is
apt list --upgradable 2>/dev/null
.And using it in your example:
Note:
2>/dev/null
is used to suppress the warning message fromapt
Try to use apticron
After installation configure it here:
It will give you a daily notification on mail if anything need to be updated.