Monday, February 27, 2006

trAPT

Ubuntu comes with a great command line tool for installing/updating/removing packages called apt* and dpkg*. The * denotes the various applications you can use i.e. apt-get, apt-cache, dpkg, dpkg-reconfigure, etc. The use of each tool is pretty much self explanatory. apt-get downloads and installs/updates packages/distro and apt-cache queries for a package you're looking for. The best part is that it will automatically connect to the server to download it without you having to have it prior to installation. Also since ubuntu is based on debian, all package format is in .deb therefore chances are you can use existing debian packages on ubuntu.

/etc/apt/sources.list is the file that stores the location of repositories to download the .deb files from.

Here are some command line options that I regularly use
  • apt-get install [package_name]
    • downloads and installs [package_name]
  • apt-get remove [package_name]
    • removes [package_name]. I usually use dpkg --purge to completely delete everything, including its configuration files as well.
  • apt-get update
    • downloads the new package information from the repositories
  • apt-get upgrade -y
    • ran after the above command, it will download and update any packages that are outdated. the -y option answers 'yes' to all questions regarding upgrades. It's es.pecially useful when running it from a crontab
  • apt-get dist-upgrade -y
    • this is the best way to upgrade your existing version to the latest version. Just run this command after a few hours, with a mere reboot, you will have your new distro ready for use. Usually most of your previous applications will work just fine but at times you will need to remove and reinstall the application for it to function but its very rare.
  • apt-cache search [package_name]
    • the best way to search for packages instead of searching via packages.ubuntu.com. Useful if you don't know the entire name of the package.
  • dpkg -L
    • list all the files installed by .
These are some of the main commands I use regularly. If i come across any new tips I'll be sure to add it here later;) Till then ciaoz;)

No comments: