DEBs, the Shell Way

For most, using Synaptic, or the simple package installer I told you about earlier, is definitely the way to go. However, as with many things, there is another way to do it and this way involves working down at the shell. If you are interested in finding out what goes on beneath Synaptic's slick exterior, take a look at this short introduction to package administration using the Linux shell.

In the Debian world, of which Ubuntu is a part, there are two useful commands for dealing with packages at the command line: dpkg and apt-get. The most basic method of installing a package is with this format of the dpkg command:

 sudo dpkg --install ftl-transport_2.1-1ubuntu1.deb 

dpkg is the basic package installation tool for Debian and Debian-based systems such as Ubuntu. The previous command installs the package. This one removes it:

 sudo dpkg --remove ftl-transport 


If it looks like I am saving keystrokes here, there is a reason. I only indicate the package release number and subsequent extensions at installation time. To remove a package, you only need the package name itself.

You should be aware that there is another step to consider when removing a package. Although the program is now gone from your system, its configuration files remain (which can be a good idea). To get rid of those as well, you need to purge the package:

 sudo dpkg --purge ftl-transport 

Now that I have had you do it the long way, you could start with a purge to both remove the package and purge the configuration files in one step.

Great, but Can You Tell Me What Is Already There?

Sure thing. If you want to get a list of every package on your system, use the --list option to dpkg. You might want to pipe that output to the more command:

 dpkg --list | more 

If something in that list should prove interesting and you would like to know more about the package, try the --print-avail flag. In this example, I try to discover something about the mysterious mtools package:

 dpkg --print-avail mtools Package: mtools Priority: standard Section: otherosfs Installed-Size: 468 Maintainer: Luis Bustamante <> Architecture: i386 Version: 3.9.9-2.1ubuntu1 Depends: libc6 (>= 2.3.2.ds1-4) Suggests: floppyd Size: 195994 Description: Tools for manipulating MSDOS files 

The preceding information only prints information about an installed package. As with many things in the Linux world (and life in general), there is more than one way to do this. You could also use the other indispensable command-line tool, apt-getto be specific, apt-cache, one of apt-get's related utilities:

 apt-cache show mtools 

The results of this command are identical to those of the preceding dpkg example.

Finding out a Package's Current Release Level

To find out the version of a package that is already installed on your system, use the l flag. In the following example, I query the system to find out what version of bash (the Bourne Again Shell) I am working with:

 dpkg -l bash Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/   Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems   (Status,Err: uppercase=bad) ||/ Name           Version        Description +++-==============-==============-============================================ ii  bash           3.1-2ubuntu6   The GNU Bourne Again SHell 

What Is That Strange File?

Let's say that you are wondering what some file is doing on your system. For instance, there is something called pinwrapper in my /usr/bin directory and I don't remember installing it. Furthermore, if I try to look it up in the man pages, I am told that there is no information on this file. Using the -S flag, I can have dpkg identify what package this file was a part of:

 dpkg -S /usr/bin/pinwrapper bluez-utils: /usr/bin/pinwrapper 

Even though I don't remember installing this bluez-utils software, I can now use apt-cache show bluez-utils to tell me what this package is for. As it turns out, they are tools for using Bluetooth devices.

Using apt-get to Install or Update Software

People who use Debian distributions on a regular basis sometimes point to this wonderful little program as the reason why Debian is so great. Well, I certainly won't be the one to deny that apt-get is wonderful.

If you want to install a package called tuxtype (a great typing tutor for kids, by the way), this is how to do it:

 sudo apt-get install tuxtype Reading package lists... Done Building dependency tree... Done The following extra packages will be installed:   libsdl-image1.2 libsdl-mixer1.2 The following NEW packages will be installed   libsdl-image1.2 libsdl-mixer1.2 tuxtype 0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded. Need to get 4341kB of archives. After unpacking 6038kB of additional disk space will be   used. Do you want to continue [Y/n]? 

The great thing here is that you do not have to go to a variety of sites to hunt down and identify appropriate software. You call apt-get with the install parameter and off you go. Notice as well that apt-get automatically picks up dependencies for a given package and installs them when needed. If you want to update to the latest version of tuxtype, substitute the install parameter with upgrade.

I don't want to confuse things here but speaking of updates, one of the most important things an administrator must do is keep packages up-to-date. You can install upgrades to all installed packages with this version of the apt-get:

 sudo apt-get upgrade 

Perhaps the most famous example of Debian's prowess is symbolized by the following command:

 sudo apt-get dist-upgrade 

This is, by no means, something that is used on a regular basis. It is used to upgrade from one major release of a distribution to another (say Breezy to Dapper).

Graphical or Nongraphical?

That is the question, or at least one of them. I routinely work with the command line and with the graphical desktop. Despite my comfort at the command line, I still use Synaptic and find it an invaluable tool.

What should you use? Synaptic is certainly easier for a new user, but the point of showing you these things is two-fold. First, I'd like you to realize that there is more than one way to do it. That applies to graphical tools (as you saw earlier in this chapter) and command-line tools. Second, I want you to see that the shell isn't that scary, even for dealing with things like software installation. In Chapter 21, the final chapter of this book, I'll give you a great introduction to working with the Linux shell.

Moving to Ubuntu Linux
Moving to Ubuntu Linux
ISBN: 032142722X
EAN: 2147483647
Year: 2004
Pages: 201

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: