Apt and Dpkg Tips

My first PC was an IBM XT clone that had 640KB of RAM and a 42MB hard drive that ran MS-DOS. I learned a bit about MS-DOS before graphical user interfaces came on the scene, so I've always had a soft spot for text-based tools. I've also found that when faced with over 200 updates (new machine install) it's often much faster to use apt to update a system. If you run a Debian-based distribution such as Ubuntu, Xandros, Morphix, you should be able to use these tips.

To update and upgrade your computer

sudo apt-get update

sudo apt-get upgrade

Only type sudo if you're using an Ubuntu-based distribution. For other distributions like Debian you should be root, or make yourself a member of the sudo group.

To search for a package

apt-cache search inkscape

Where inkscape is, put the name of the package or the concept of the package you're looking for. e.g. graphics. Note that you do not have to be root to search for a package.

To install a package

sudo apt-get install inkscape

When installing software you either need root access or sudo access. This command would install the package inkscape if it was available.

To see if a package is installed

dpkg -l | grep pidgin

Note that the -l is a - and a small L. The | after the small L is called pipe. It looks like a couple of vertical dashes on top of one another. It's commonly found over the \ key. The pidgin text should be replaced with the name of whatever package you're looking for. The grep command is a pattern searching command. dpkg -l on it's own will give you a list of all the packages. Grep acts like a filter and will show all the packages that match the pattern pidgin.

To see the files within a package

Sometimes I want to get a listing of all the files within a package and where they're installed. I have a habit of twisting software to my own needs (changing graphics, etc.). Knowing exactly where all the programs within a package go is one of those control things I love about Linux:

dpkg -L pidgin

In the example above dpkg will list all the programs within the pidgin package including man pages.

Apt and dpkg are seemingly simple tools, and what I've introduced just scratches the surface of what these tools are capable of. If you're looking to break out of the gui, figuring out these commands are a good place to start.

Correction

Oops, my XT had 640 kb of RAM not MB... man I must be tired. *corrected*