I am new to this platform so can some one help me out for some commands.
I need some commands on patching a server for only specific packages.
After upgrading packages how to figure out package updated to latest version or not ??
I am new to this platform so can some one help me out for some commands.
I need some commands on patching a server for only specific packages.
After upgrading packages how to figure out package updated to latest version or not ??
There are a lot of different solutions/workarounds I'm going to mention some:
Use dpkg -l pkg-name
to get package version, e.g:
$ dpkg -l firefox
it's going to give you some information:
||/ Name Version Architecture Description
+++-==========================================================================
ii firefox 53.0.3+build1-0ubuntu0. amd64 Safe and easy web brow
Depends on your package switches like -v
or --version
might be available to you:
firefox -v
Then use sudo apt update
to make sure your sources are up to date, and use apt show firefox | grep -i version
to see the last version available.
You can also check https://packages.ubuntu.com to search for your package version.
As an alternative you can use apt changelog pkg-name
, e.g apt changelog firefox
this will connect to internet to get the last "change log" data so you don't have to update your sources for using this command.
The other option is rmadison
, it remotely query the archive database about a packages, so you don't have to update your source in this option.
First install its package: sudo apt install devscripts
, then use it like:
rmadison -s zesty -a amd64 wget
it give you last available version of wget
for "zesty" and "amd64" architecture.
It is possible to use apt-cache
like this,
$ apt-cache policy <package-name> # generic
$ apt-cache policy firefox # example with output
firefox:
Installed: 53.0.3+build1-0ubuntu0.16.04.2
Candidate: 53.0.3+build1-0ubuntu0.16.04.2
Version table:
*** 53.0.3+build1-0ubuntu0.16.04.2 500
500 http://se.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages
100 /var/lib/dpkg/status
45.0.2+build1-0ubuntu1 500
500 http://se.archive.ubuntu.com/ubuntu xenial/main i386 Packages
Update listing the sources
sudo apt-get update
or (newer syntax)
sudo apt update
Upgrade a particular package (and whatever is needed to support the new version)
sudo apt-get install <package-name>
or (newer syntax)
sudp apt install <package-name>
Upgrade the installed packages, which have upgrades available
sudo apt-get dist-upgrade
or (newer syntax)
sudo apt upgrade
or
sudo apt full-upgrade
See the manual pages
man apt-get
and
man apt
for more details.
If you are looking to patch a server for only a particular package you can do sudo apt-get install --only-upgrade <packagename>
. This will upgrade only that single package, and only if it is installed. You can then use <packagename> --version
to verify the current version of the installed package. You can also use dpkg -l | awk '$2=="<packagename>" { print $3 }'
to verify the version as well.
ctrl + alt + F1
to get a text screen; 2.sudo service lightdm stop
; 3. do something while lightdm is stopped; 4.sudo service lightdm start
– sudodus Jun 09 '17 at 02:37apt-cache policy
. Some of the output text terms are localized. – bleater Apr 17 '23 at 00:05LANG=C apt-cache policy package-name
. In Ubuntu 22.04.x LTS firefox is packed via snap, which can be checked viaLANG=C snap list firefox
. – sudodus Apr 17 '23 at 08:59