https://help.ubuntu.com/community/AptGet/Howto
If an update process is killed, it might not release the lock.
sudo rm /var/lib/dpkg/lock
Install:
dpkg -i package.deb
Install specific version of a package:
http://blog.andrewbeacock.com/2007/03/how-to-install-specific-version-of.html
Reconfigure (in case made a wrong configuration or somehow an error occurred during configuration; note: during installation the configuration for multiple packages may be performed. the one needs to be reconfigured might not the one installed by command, but a package installed by dependency)
dpkg-reconfigure package-name
Remove:
dpkg -r package-name
List contents of a deb package archive / installed package by name
dpkg -c, --contents archive
dpkg -L, --listfiles package-name...
List packages matching given pattern
dpkg -l, --list package-name-pattern...
In this way, retrieval of packages will become much faster if already retrieved before (not yet tested)
https://help.ubuntu.com/community/Apt-Cacher-Server
Find out package that a file belongs, installed or not:
apt-file search filename
apt-file search /path/to/file
dlocate <package_name>
Installing and to use apt-file:
apt-get install apt-file
sudo apt-file update
Find out package that a file belongs, installed or not:
apt-file search filename
apt-file search /path/to/file
dlocate <package_name>
Sometimes a file cannot be found, because it is a link pointing to the real file. Search the real file.
Find package by name:
apt-cache search <search_term>
dpkg -l *<search_term>* - also show if package is installed (ii) or not (un)
Show package description and version, etc.:
apt-cache show <package_name>
dpkg --print-avail <package_name>
Reference:
https://help.ubuntu.com/community/Repositories/Ubuntu
https://help.ubuntu.com/community/Repositories/CommandLine
https://help.ubuntu.com/community/AutomaticSecurityUpdates
http://www.centos.org/docs/5/html/yum/sn-updating-your-system.html
CentOS:
yum update (preserve obsolete packages)
yum upgrade (delete obsolete packages)