home index sites engineering software hardware email
 

How-To: Ubuntu



About




Official Documentation & Support




Unofficial Documentation & Sites




.deb Cheat Sheet


To install a package from a package file (a file ending with '.deb'):

dpkg -i some_package_name.deb

To extract all the files from a package file:

dpkg -X some_package_name.deb /some/dir

To install all packages recursively from a directory:

dpkg -R /some/dir

To remove an installed package (configuration files are not removed):

dpkg -r some_package_name

To purge an installed package (removes everything, including configuration files):

dpkg -P some_package_name

To list partially installed packages:

dpkg -C

To list the contents of a package file:

dpkg -c some_package_name.deb

To show information about a package file:

dpkg -I some_package_name.deb

To display details about an installed package:

dpkg -p some_package_name

To list all installed packages:

dpkg -l

To list packages matching a regular expression:

dpkg -l <pattern>

To show the status of a package:

dpkg -s some_package_name

To list files installed from a package:

dpkg -L some_package_name

To search for a filename from installed packages using a regular expression:

dpkg -S <pattern>

To search for a particular package using a regular expression based on package names and descriptions (separate arguments can be used to specify multiple search patterns which are and'ed together):

apt-cache search <pattern>

To install packages to fix broken dependencies:

apt-get -f install

To simulate an "aptitude full-upgrade" (i.e. a full upgrade - to help find packages that are being held back) add "-s":

sudo aptitude -s full-upgrade


To download the package .deb:

aptitude download some_package_name


To download the package source code:

apt-get source some_package_name


Tips & Tricks


Ubuntu Lucid Lynx 10.04


x11vnc shift key bug

If you are having problems with the shift key when using x11vnc a work around is to use the '-xkb' option until the bug is fixed.

Gnome power manager memory leak

The Gnome power manager (gnome-power-manager) has a memory leak bug that causes it to slowly drain all the memory on your computer (see Launchpad Bug #569273: memory leak in gnome-power-manager for more information, and no Ubuntu has decided not to fix this in Lucid). You can limit the memory leak on desktop systems by opening the power management preferences dialog box (System > Preferences > Power Management) and selecting "Never display an icon" under "Notification Area" on the "General" tab, then click close.

If you need to restart gnome-power-manager you can kill the process by running the following command then opening the "Power Management" dialog again (no need to change any setting, just click on "Close").

killall -HUP gnome-power-manager


For all releases


Restarting X

Ubuntu since Jaunty disables the key combination of CTRL+ALT+BACKSPACE as way to restart X. There are several ways to restore that feature, including modifying /etc/X11/xorg.conf to contain the following:

Section "ServerFlags"
   Option "DontZap" "false"
EndSection

Alternatively you can use the key combination of 'right-ALT + PRINTSCREEN + k' to restart X.


Compiz


Here is a good article on getting Compiz working under Ubuntu. Note that Ubuntu Hardy includes Compiz, you simply need to enable it and get the Emerald window manager (plus some nice themes).


Monitor Resolution


If you are having problems with the resolution of your monitor under X check out this page for some useful tips. If you need to reconfigure the display you can run displayconfig-gtk, while to change the resolution of your boot screen edit /etc/usplash.conf then run update-initramfs -u. Some other good tips can be found here.


Fonts!


Get the nice aenigma free fonts from here (source).

Some 'fun' fonts are available from here (source).

More font sites:

To install TTF fonts under Ubuntu:

sudo mkdir /usr/share/fonts/truetype/fontname
sudo cp <font_files> /usr/share/fonts/truetype/fontname
fc-cache -f -v


Managing services


Use 'update-rc.d' to enable/disable a service (see Human-Readable Descriptions of init Scripts for a good list services). For example to disable the service 'servicename' run (you made need to install the sysv-rc-conf package first):

sudo update-rc.d -f servicename remove

To enable the service 'servicename' run:

sudo update-rc.d servicename defaults

Top start or stop a service:

sudo /etc/init.d/servicename start
sudo /etc/init.d/servicename stop

The sysvconfig package contains an ncurses GUI that makes it easy to manage services using the program 'sysvconfig' (you can also use the "Ubuntu BootUp Manager or BUM", installed via the bum package):

sudo sysvconfig

The sysvconfig package also contains the 'service' program that can be use to start or stop a service:

sudo service servicename start
sudo service servicename stop


Resetting the MySQL root password


This allows you to reset the root password for MySQL.

sudo /etc/init.d/mysql reset-password


Adding a PPA repository with a single command


This allows you to add a PPA, just replace PPANAME with the name of the PPA to add (requires the python-software-properties package installed which is only available with 9.10 or later).

sudo add-apt-repository ppa:PPANAME


Fix for "GPG Error BADSIG"


If you are getting "GPG Error BADSIG" messages when trying to update, such as the following:

GPG error: http://download.virtualbox.org lucid Release: The following signatures were invalid: BADSIG 54422A4B98AB5139 Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>

Then you need to perform a cleaning of your apt meta data (ref: http://www.virtualbox.org/wiki/Linux_Downloads).

First disable any apt proxies you are using (the following is specific to my setup):

sudo mv -f /etc/apt/apt.conf.d/01proxy /tmp

Then clean your apt meta data:

sudo apt-get clean
sudo rm /var/lib/apt/lists/*
sudo rm /var/lib/apt/lists/partial/*
sudo apt-get clean
sudo apt-get update

Finally restore any proxy you disabled (once again the following is specific to my setup):

sudo mv /tmp/01proxy /etc/apt/apt.conf.d