Created Novemember 6, 2002.
(Transferred from Wiki by Peter)
Debian is regard by many people to be the best and purest of all linux distributions, one of its strengths is its excellent package management systems combined with apt-get. This cheat sheet will give some of the common commands used by Debian and other distributions based on Debian. Debian packages are often called debs because they have a .dep suffix. On with the cheat sheet! First dpkg then apt-get
If I am interested in only one package or I want some information I use dpkg
- this installs a packge named packagename, e.g. dpkg -i zsh_4.0.4-33_i386.deb.
dpkg -i packagename.deb
dpkg -s packagename
- This will return the status on a package, e.g. dpkg -s fvwm, note the suffix .deb is not used with this command.
- Lists all the files in package, e.g. dpkg -L zsh will list all the files installed with the package we installed in the first step. Again, the suffix .deb is not used.
dpkg -L packagename
- This will tell the user what package the file filename belongs too. e.g. dpkg -S init-restart.hook will let the user know that the file init-restart.hook belongs to the package fvwm. The full path can be given,e.g. dpkg -S /etc/X11/fvwm/init-restart.hook , but it is not needed. If the full filename is not known a partial name can be given also. e.g. dpkg -S restart would give the results with all packages that have a file that has restart in the name.
-This will remove the package from the system. e.g. dpkg -r zsh will remove the package installed at the start of this cheat sheet.
dpkg -r packagename
Now for apt-get!
- This is a common command that will install the package packagename, if it needs to it will also resove dependencies and install them all. There is no need to say add the veriosn information or the .deb to this and doinng so will result in an error. An example would be: apt-get install fvwm2
apt-get install packagename
This downloads the source code of the package. e.g. apt-get source fvwm2
apt-get source packagename
This will update the list of packages available to be installed. It does not actually update any package!! This takes no arguements, e.g. apt-get update kernel will not update your kernel.
Like apt-get update this command does not take any extra arguement, it will however upgrade all the packages on you machine that are out of date.
This will remove the packaes that have been downloaded which are kept in /var/cache/apt/archives. This saves disk space and if you have apt-get upgrade run automatically this should be done on a regular basis.
Those are the main apt-get commands I use. For apt-get you do need a sources-list - Mine is listed below, this is the file /etc/apt/sources.list