apt-get cheatsheet




nixCraft » Debian Linux apt-get package management cheat sheet » Print


– nixCraft – http://www.cyberciti.biz/tips

Debian Linux apt-get package management cheat sheet

Posted By LinuxTitli On May 9, 2005 @ 12:21 pm In Debian Linux, Howto, Linux, Sys admin, Tips, Ubuntu Linux | 6 Comments

[1]

Both Debian and Ubuntu Linux provides a number of package management tools. This article summaries package management command along with it usage and examples for you.

(1) apt-get : APT is acronym for Advanced Package Tool. It supports installing packages over internet (ftp or http). You can also upgrade all packages in single operations, which makes it even more attractive.

(2) dpkg : Debian packaging tool which can be use to install, query, uninstall packages.

(3) Gui tools:

You can also try GUI based or high level interface to the Debian GNU/Linux package system. Following list summaries them:
(1) aptitude [2]: It is a text-based interface to the Debian GNU/Linux package system.
(2) synaptic [3]: GUI front end for APT

Red hat Linux package names generally end in .rpml similarly Debian package names end in .deb, for example:
apache_1.3.31-6_i386.deb

apache : Package name
1.3.31-6 : Version number
i386 : Hardware Platform on which this package will run (i386 == intel x86 based system)
.deb : Extension that suggest it is a Debian package

Remember whenever I refer .deb file it signifies complete file name, and whenever I refer package name it must be first part of .deb file. For example when I refer to package sudo it means sudo only and not the .deb file i.e. sudo_1.6.7p5-2_i386.deb. However do not worry you can find out complete debian package list with the following command:

apt-cache search {package-name}

apt-get add a new package

Add a new package called samba
Syntax: apt-get install {package-name}

# apt-get install samba

apt-get remove the package called samba but keep the configuration files

Syntax: apt-get remove {package-name}

# apt-get remove samba

apt-get remove (erase) package and configuration file

Syntax: apt-get –purge remove {package-name}

# apt-get --purge remove samba

apt-get Update (upgrade) package

Syntax: apt-get upgrade

To upgrade individual package called sudo, enter:
# apt-get install sudo

apt-get display available software updates

Following command will display the list of all available upgrades (updates) using -u option, if you decided to upgrade all of the shown packages just hit ‘y’

# apt-get upgrade samba

However if you just wish to upgrade individual package then use apt-get command and it will take care of rest of your worries:
Syntax: apt-get install {package-name}

dpkg command to get package information such as description of package, version etc.

Syntax: dpkg –info {.deb-package-name}

# dpkg --info sudo_1.6.7p5-2_i386.deb | less

List all installed packages

Syntax: dpkg -l

# dpkg -l

To list individual package try such as apache

# dpkg -l apache

You can also use this command to see (verify) if package sudo is install or not (note that if package is installed then it displays package name along with small description):

# dpkg -l | grep -i 'sudo'

To list packages related to the apache:

# dpkg -l '*apache*'

List files provided (or owned) by the installed package (for example what files are provided by the installed samba package)
Syntax: dpkg -L {package-name}

# dpkg -L samba

(H) List files provided (or owned) by the package (for example what files are provided by the uninstalled sudo package)

Syntax: dpkg –contents {.deb-package-name}

# dpkg --contents sudo_1.6.7p5-2_i386.deb

Find, what package owns the file /bin/netstat?

Syntax: dpkg -S {/path/to/file}

# dpkg -S /bin/netstat

Search for package or package description

Some times you don’t know package name but aware of some keywords to search the package. Once you got package name you can install it using apt-get -i {package-name} command:
Syntax: apt-cache search “Text-to-search”

Find out all the Debian package which can be used for Intrusion Detection

# apt-cache search "Intrusion Detection"

Find out all sniffer packages

# apt-cache search sniffer

Find out if Debian package is installed or not (status)

Syntax: dpkg -s {package-name} | grep Status

# dpkg -s samba| grep Status

List ach dependency a package has…

Display a listing of each dependency a package has and all the possible other packages that can fulfill that dependency. You hardly use this command as apt-get does decent job fulfill all package dependencies.

Syntax: apt-cache depends package

Display dependencies for lsof and mysql-server packages:

# apt-cache depends lsof
# apt-cache depends mysql-server

Further reading


Article printed from nixCraft: http://www.cyberciti.biz/tips

URL to article: http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html

URLs in this post:

[1] Image: http://www.cyberciti.biz/tips/category/debian-linux

[2] aptitude: http://www.cyberciti.biz/images/blogs/tips_tricks/aptitude030505.jpg

[3] synaptic: http://www.cyberciti.biz/images/blogs/tips_tricks/synaptic.png

[4] cheat sheet: http://www.cyberciti.biz/howto/question/linux/dpkg-cheat-sheet.php

[5] cheat-sheet: http://www.cyberciti.biz/howto/question/linux/apt-get-cheat-sheet.php

[6] APT and Dpkg Quick Reference Sheet: http://www.cyberciti.biz/tips/ref/apt-dpkg-ref.html

Copyright © 2004-2009 nixCraft. All rights reserved.



How to fix networking after cloning an Ubuntu 8 VM

Stolen from: http://weblog.jamisbuck.org/2008/8/15/cloning-ubuntu-hardy-image-in-vmware-fusion

* “sudo hostname blah”, to set the hostname. This doesn’t change it permanently, so you’ll also want to:
* “sudo vim /etc/hostname”. Change the contents of the file to the hostname you want. Then:
* “sudo vim /etc/hosts”. Replace all mentions of the old hostname with the new hostname.
* “sudo vim /etc/udev/rules.d/70-persistent-net.rules”. There will be two entries in this file. The first points eth0 at the old MAC address, and the second points eth1 at the new. Go ahead and delete the first entry, and change “eth1” to “eth0” in the second (and now only) entry.
* “sudo shutdown -r now” to restart your virtual machine.

asinine espn bar management

Hmmm … So, we went to the ESPN bar on the Boardwalk Disney in Orlando and expect just some typical bar food and a drink before going home and back to bed just after midnight last Thursday evening and we got probably the worst service ever.

The greeting we got something to the tune of there is no food service. You can only order drinks. At first, we were thinking about just leaving, but then decided what the heck. We might as well. So, one guy asks what some of the beers were. The waiter says, “it’s a beer”. He couldn’t give a better description for any of the beers! One guy orders a Jamison neat (no water, no ice). What’s is that? Shouldn’t you know if you’re a waiter? Oh well. No big deal.

I order the “Zone” drink, but asked for a shot of rum in in. I got the drink without rum in it. The person next to me ordered a milk shake. She got a drink with cream and shaved ice. Another guy ordered 2 drinks. He ordered the Zone and a beer. When he asked what kind of beers they were (menu just had names on it), the waiter responded with something like “it’s a beer.” When the drinks came, he just got the beer. When he asked for the waiter to get his other drink, the waiter said, “no, you didn’t [order the 2 drinks]” and he added that he couldn’t go back because the bar was closed and that the bartender was pissed that he even took the order.

When the check came, I was charged 6.50 for the rum. We called the waiter back and told him this and told him that there wasn’t rum and that he could taste it if he wanted to. He declined to taste it. He then brought his manager. The manager then argues with me and says that the recipe called for rum. The drink was special order – it wasn’t even on the menu! How could they have a recipe!?

The waiter said i should’ve told him there was a problem with my drink before the check came, but the bar was closed immediately after drinks were served! What was he going to do? Go back to the bar!? He told us that he couldn’t do that!

Later, the manager said that he was willing to take the drink off, but that we couldn’t tell him that he didn’t make the drink right while neither of them were willing to taste the drink.

They just took off the $6.50. They didn’t take off the whole drink like they said. They also charged an 18% gratuity as well!

So atop of that, we had to pay a very undeserved 18%!

The Evolve Showerhead WON’T save you an ounce of water!

My friend Larry Adkins reviews shower heads online, and he says it’s not EXACTLY a scam. It just won’t save you any water if you’re not the type that turns on the water and walks away. It must have either a timer or a temperature gauge (not sure which) that just slows the water down to drops after a little bit of time so that you can just go and flip the switch when you’re ready to go and shower. If you’re one that waits for the water to warm up in the shower, you will save no water whatsoever.

DSL Extreme really, really sucks…if your service goes out.

Well, the service is great if it’s working. If you look at my hosting provider, it’s DSL Extreme. My service was down for almost the entire month of July because DSL Extreme technical support was incompetent enough to solve my problem. Their technical support was giving me the runaround and passing me off to billing and the left hand was totally not talking to the right. It was partially AT&T’s fault, but I was paying DSL Extreme, not AT&T and I couldn’t talk to AT&T directly.

Wednesday – call from billing saying it’s been disconnected and I should get an email for an activation date within 48 hours. Not the actual activation, but an activation date. Billing says that I won’t get credit for any of the down time because I lost line share and that I should be contacting AT&T for credit because it was them that disconnected my line and that it’s in the “Terms and Conditions” that I am supposed to have the line available the whole time. How do I know this is true? I didn’t lose dialtone myself. At least not that I’m aware of.
Here are a couple of typical technical support chat sessions:
Michelle:
Thank you for calling DSL Extreme. My name is Michelle. How may I help you?
uslacker99:
please check on the status of my service – Alton Yu 415-239-xxxx
Michelle:
Jsut a minute please
Michelle:
We finalized the disconnect on 7/15, it takes 5 days for the line to clear and then we can place the reconnect order
uslacker99:
I didn’t get an activation date
Michelle:
Is there anything else that I can help you with?
uslacker99:
Should I not have gotten an activation date?
Michelle:
We have not set the activation date yet
uslacker99:
I was told I should’ve had it 24-48 hours
Michelle:
until we can place the order for reactivation, we will not have a date
uslacker99:
ok
Michelle:
We will email you with the activation date
uslacker99:
is there any way to expedite this?
uslacker99:
I haven’t had service for 2 weeks.
Michelle:
Unfortunately there is not a way to speed up the process
uslacker99:
Are you sure?
uslacker99:
Is there an escalation process?
Michelle:
I am sorry but there is not a way
uslacker99:
You’re positive that there’s no faster way?
Michelle:
We are processing it as fast as we can
uslacker99:
Can I have your word on that?
Michelle:
We are moving as fast as we can
uslacker99:
okay then.
Michelle:
Is there anything else that I can help you with?
uslacker99:
nope

———————
7/22
Jeff:
Thank you for calling DSL Extreme. My name is Jeff. How may I help you?
uslacker99:
please check on the status of my service – Alton Yu 415-239-xxxx
uslacker99:
this is the 18th day I haven’t had service 🙁
Jeff:
there is an open Trouble Ticket,
Jeff:
I show account active
uslacker99:
it’s not active. it’s not working
Jeff:
what is the status of the light on your modem?
uslacker99:
last time i looked, it was blinking green.
Jeff:
kk, let me transfer you to our Tier 2 technisions
Jeff:
Ticket#: 3121480
Jeff:
this is your Trouble Ticket, one moment please…
uslacker99:
there should be a disconnect/reconnect going on with billing. they said it was disconnected last tuesday, but no word as to when it would be reconnected.
Jeff:
kk, our Tier 2 tech’s should be able to see what the status is..\
Jeff:
one sec please
Jeff:
Has transferred you to:
Chat Session Ended, Goodbye. (5010)

pkgs to install in Ubuntu for Apache …

This is just for reference so that I know which packages I installed to get php navigator working. I’ll uninstall all of them if I ever need to remove it.

apache2-mpm-prefork defoma fontconfig-config libapache2-mod-php5 libfontconfig1 libfreetype6 libgd2-xpm libjpeg62 libpng12-0
libt1-5 libx11-6 libx11-data libxau6 libxdmcp6 libxml2 libxpm4 php5-common php5-gd ttf-dejavu ttf-dejavu-core ttf-dejavu-extra
x11-common apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1 libpcre3 libpq5 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server
mysql-server-5.0      apache2-mpm-prefork libapache2-mod-php5 libxml2 php5 php5-common
defoma fontconfig-config libfontconfig1 libfreetype6 libgd2-xpm libjpeg62 libpng12-0 libt1-5 libx11-6 libx11-data libxau6
libxdmcp6 libxpm4 php5-gd ttf-dejavu ttf-dejavu-core ttf-dejavu-extra x11-common php5-mysql

Acura vs. Lexus … just to get a quote …

I ask the acura guy …
how much for the car
he writes back …

Special Financing available for all 2008 Acura TL’s in stock for .9% for 36 months and 2.9% for 60 months on approval of credit.

2008 TL Navi for $30,000+ Tax + Licensing Fees (MSRP $36,940).

idiot from lexus …
Catherine: i’m thinking of getting a used bmw
Because there are so much variation in equipment options, in order to put together most aggressive and accurate price possible, I was wondering if you could either send an email or give me a phone call with options you want on your new vehicle.  I will be calling you soon and/or emailing you. To contact me you can call me directly at (650)994-2255. I look forward to serving you.
then …
I copy acura’s quote
and say I want something similar
he writes back …

If you compare to the price, for sure Acura is cheaper, but I want you to understand the more you pay, more you get. Lexus use the finest material to build our cars, so you can find that vehicle dependability report we’re always No.1, our vehicle will be much more luxury than a acura, engine much smooth and quite. Is all your decision, acura is a nice car too, if you want something more budget, I think is a good choice. If you want to get the finest and luxury vehicle, Lexus is your choice!
my response …
I don’t want to come in and look first. I’m not only considering price. I’ll test drive the two after I get a quote.

According to this: http://www.newcars.com/lexus/es350/reviews/acura-tl.html

The prices should be comparable.
he comes back with … what equipment that you interested to have it in the ES350?
I was like … what the hell!
finally! he goes …

If you want navigation this is the package you will get for 2008:
P             Z1             Trunk Mat, Cargo Net and Wheel Locks
F             BE             Rear Seat Side Airbags                               F             HH             Heated and Ventilated Front Seats                               F             NV             Navigation System Includes:                               F             PM             Premium Package Includes:

MSRP: $39615 + fees, and you can have it for $34423 + fees, color is limited for 2008.Please let me know when is the better time for you to come! Thanks
and of course, I come back with what I forgot …

Ok. Which colors are available and do you have any special financing like Acura does?

it took 4 emails from lexus what it took 1 from acura!

HOW TO move ESX hosts between clusters without maintenance mode

I’ve done this a number of times and never had a problem, but this may not be a good idea.

The steps are to:

1. Right click and disconnect the ESX host from vCenter.
2. Right click and remove the host you just disconnected from vCenter (may hang VC temporarily in the minute rangeor operation may time out) re-log back into VC, once you are able to it host should be gone from the cluster.
3. Re-add to VC under new cluster