Sunday, November 13, 2005

Debian Package management

Debian Package management

apt-get update
Run this after changing /etc/apt/sources.list or /etc/apt/preferences. (this debianhelp.org page is helpful); run it periodically anyway, to make sure your source list is up-to-date.

apt-get install packagename
installs a new package: rpm -i package.rpm

apt-cache search string
Searches for string in the list of known packages: like using rpmfind.

dpkg -l package-name-pattern
List packages matching pattern: rpm -q pattern or rpm -qa | grep pattern.
aptitude
Curses viewer of packages installed or available.

apt-cache showpkg pkgs...
Show information about packages.

apt-cache dumpavail
Prints out an available list.

apt-cache show pkgs...
Displays package records, similar to dpkg --print-avail. Like rpm -q packagename.

apt-cache pkgnames
Fast listing of every package in the system.

dpkg -S file
Which installed package owns the file? rpm -qf file.

dpkg -L package
List files in the package. rpm -ql package

apt-file search filename
Search for a package (need not be installed) containing files including the string. apt-file is a package of its own, which you may have to apt-get install first, then run apt-file update. If apt-file search filename shows you too much, try apt-file search filename | grep -w filename (which shows you only the files that contain filename as a whole word) or variants like apt-file search filename | grep /bin/ only files located in directories like /bin or /usr/bin, useful if you're looking for a particular executable).

apt-get autoclean
Run this periodically to clean out .deb archives from packages which are no longer installed on the system. You can regain lots of disk space that way. If you're really desperate for disk space, apt-get clean is more radical, and will remove .deb files even for packages currently installed. But most of the time you probably don't need the .debs any more, so it might be worth it if you're strapped for megabytes.

apt-cache policy pkg
Show which repository pkg came from, if you have multiple ones in sources.list.

apt-cache show | grep ^Source
Find the source package which produces this binary package. If it returns nothing, then the source package name is the same as the binary package name.

apt-cache depends
Show what depends on.

apt-cache rdepends
Show what other packages depend on . grep-excuses
Show why package, in unstable, isn't in testing yet.

deborphan and debfoster are great for finding orphaned and unneeded packages which can be removed.

You can pull from a different repository by editing /etc/apt/sources.list to replace "stable" with "unstable" (or whatever) then doing apt-get update.

0 Comments:

Post a Comment

<< Home