Monday, June 1, 2009

Using APT-GET Quick Reference

Using apt-get
This is a small quick reference post on using apt-get in BT
There is a ton of info about it throughout the internet. I merely wanted to post the basics for those that may be to lazy, or unwilling to look elsewhere.
So first and foremost:
There are 3 basic installers in BT4 apt-get the basic command line package
management system. aptitude is a curses based front end for apt-get.
And synaptic which is a gui version. Other than that there really are no major
Now lets look at some of the commands that are available for us.

# man apt-get

The manual page read it.

# apt-cache pkgnames

Gives us the names of all the installed packages we have on the system.
The list is not really to organized so add a | pipe and sort to the end and then it will alphabetized.

# apt-cache search programname

add the name of a program that you want to search for. The command will show software packages with the expression you entered. One problem with apt is that it really needs the exact name of a package for better results.

# apt-get install packagename

Pretty simple since all the work is now done for you.
There is a caveat to this method of package installation. You can't pass any
configuration options to the program. To remove a package just the opposite
should be done.

# apt-get remove packagname

This will remove the package but may not remove all configuration files. In order for that do instead

# apt-get remove --purge packagename

Next updating software.

# apt-get update

This updates the list of currently installed software, this is the same list that we saw earlier. Next actually updating said list.

# apt-get upgrade

Now the thing about this command is that it will upgrade to the most recent
version of all packages on the system. This may or may not always be the best way of doing business. Some packages may not work as well as the older ones. Use with care. use a -s before upgrade to simulate, or see which software will be updated. A better way is to use dist-upgrade

# apt-get dist-upgrade

This will upgrade all packages with conflict resolution and discarding less important packages for more important ones. There are many other commands but the above should help get you started working with apt. Hope it helps.
Credits: This tutorial was created with help from the Debian APT How-To which can be found here: Debian -- Debian Documentation Project
And the man page


aerokid240 said...

Hey man, i love your kool blog about backtrack. I hope you don't mind me referring to certain portions of your website for information to save me the trouble of reinventing the wheel. I'd like to refer to this cheat sheet on using apt-get on my security blog, Keep up the good work

Tai Long said...

A can post on my blog?
sorry for bad english
Have a fun!