Jul 252010

From blogs.pcworld.co.nz

Hidden Linux : agt-get secrets

apt-get is the package handling utility behind Debian-based Linux systems such as Ubuntu, Mint and Mepis. You may be using it ‘by proxy’ via GUI-based package managers such as Synaptic, but hardened Linux users tend to prefer the command line – especially as the latter has a couple of neat tricks up its sleeve.

(Not that if you’re not a super-user you’ll need to prefix the following commands with sudo – well, all but the last one …)

The basics

apt-get update

Resynchronise installed packages with their sources. (Always do this before an upgrade.)

apt-get upgrade

Install the newest version of all packages installed on the system.

apt-get dist-upgrade

Upgrade to the latest version of your distribution.

apt-get install xxx yyy zzz

Install programs xxx, yyy and zzz along with all their dependencies.

apt-get remove xxx yyy zzz

Remove programs xxx, yyy and zzz.

apt-get purge xxx yyy zzz

Remove programs xxx, yyy and zzz and delete any configuration files that they used.

apt-get check

Update the package cache and check for any broken dependencies.

apt-get clean

Clean out retrieved package files.

apt-get autoclean

Clean out retrieved package files, but only those that are no longer needed.

apt-get autoremove

Remove any packages that were installed to satisfy dependencies but are no longer required.

Advanced stuff
So much for the basics, what about those neat tricks I mentioned? Well, did you know you can use apt-get to get a package’s source code?

apt-get source xxx

Retrieve source files for package xxx.

Or its build dependencies?

apt-get build-dep xxx

Get all the dependencies needed to build package xxx.

Or that you could get it to fetch and build the package for you?

apt-get source xxx -b

Fetch the source code then compile it. (The -b switch means ”build it„.)

The result with be a .deb package which you can install using the Debian package manager command:

dpkg -i xxx.deb
Share This!
 Posted by at 3:13 am

Sorry, the comment form is closed at this time.