Refer: https://itsfoss.com/list-installed-packages-ubuntu/
Example of how to upgrade sublime-text from the command line, the first step, is just to make sure it's installed and to get its proper name.
apt list --installed | grep -i sublime
sudo apt-get update
sudo apt-get --only-upgrade install sublime-text
To list packages using apt command:
apt list --installed
To list packages using dpkg command:
dpkg-query -l
To list Snap packages installed on your system:
snap list
To list Flatpak packages installed on your system:
flatpak list
List the recently installed packages
So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently?
Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages.
There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log.
You’ll have to use grep command to filter the result to list the installed packages only.
grep " install " /var/log/dpkg.log
You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right?
grep " install " /var/log/apt/history.log
List recently installed packagesListing recently installed packages
The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command.
