We hope to answer
dpkg
vs apt
vs apt-get
find installed packages
sudo apt list --installed *<part-of-package-name>*
look for packages to install, with more info
apt search <part-of-package-name>
or
dpkg --list | grep <package-name-fragment>
reinstall package
sudo apt --reinstall install <package>
Update packages
sudo apt update && sudo apt upgrade
Note: we want to prevent “unattended” upgrades on hardware. (only upgrade when we mean to). upgrading can also block us from installing something we need, or introduce new bugs at a bad time.
sudo apt remove -y unattended-upgrades
/usr/share/applications
/usr/share/icons
.bashrc holds path variables.
Based on this link
Might as well be fully updated first
sudo apt update
sudo apt upgrade
sudo shutdown -r now
edit which upgrade you want to do (lts or normal)
sudo nano /etc/update-manager/release-upgrades
change prompt=lts
to prompt=normal
run updater
do-release-upgrade
you may need to indicate what to do with specific config files that get updated.
Restart
sudo shutdown -r now
To list the repositories on your system, you can use the command:
apt policy
To remove a repository:
sudo add-apt-repository --remove ppa:PPA_Name/ppa
when you want to install a package, sometimes many other dependencies get installed that you did not specify. Here’s how you can list packages installed intentionally vs required dependences that were not specified
apt-mark showmanual
To clone your system to another system. Or make a backup. In a terminal type:
dpkg --get-selections | grep -v deinstall > ubuntu-files
This command makes a file list of all installed packages in your system (and stores it in present working directory). Backup this file in hdd, email, etc…(this file is very small).
In the freshly installed ubuntu system run:
sudo dpkg --set-selections <./ubuntu-files (will set it up and)
apt -y update
apt dselect-upgrade
This will install only those packages you had installed (with apt) in the old system.
(OR)
You could back up all the .deb packages from /var/cache/apt/archives/
and install them manually using:
dpkg -i *.deb
And after that running an update cycle later.
You can inspect logs to find installed files:
less /var/log/apt/history.log
Older log files have a number suffix and are compressed. So to view the next history log, use:
zless /var/log/apt/history.log.1.gz
To view the logs available:
ls -la /var/log/apt/
Thus, the first step is to find the first line number where a particular date occurs
cat /var/log/apt/term.log | grep -n 08-15
do that again to find the beginning of the second date range if necessary
cat /var/log/apt/term.log | grep -n 08-16
Then use this technique to select only part of the log and then identify newly added packages
sed '915,10000000!d' /var/log/apt/term.log | grep -i "selecting previously unselected"
this returns something like
Selecting previously unselected package libglfw3:amd64.
Selecting previously unselected package libgl1-mesa-glx:amd64.
Selecting previously unselected package libosmesa6:amd64.
...
Selecting previously unselected package libosmesa6-dev:amd64.
Selecting previously unselected package libglu1-mesa-dev:amd64.
Selecting previously unselected package libglew-dev:amd64
by doing a quick find/replace you can then clean up the list and do a sudo apt remove
sudo apt remove libglfw3:amd64 libgl1-mesa-glx:amd64 libosmesa6:amd64 \
...
libegl1-mesa-dev:amd64 libosmesa6-dev:amd64 libglu1-mesa-dev:amd64