Find the download location URL,name, size and MD5 sum of a software package using apt-get

Debian package management provide with you with immense capabilities. Using the --print-uris options, we can get a lot of useful information about the package, rather than installing it. It tells us about the package download location/URL, name, size and MD5 or SHA sum for archive integrity. Here is an example.

[shredder12]$ sudo apt-get install --print-uris pidgin-themes
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  pidgin-themes
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 1,474kB of archives.
After this operation, 4,907kB of additional disk space will be used.
'http://in.archive.ubuntu.com/ubuntu/pool/universe/g/gaim-themes/pidgin-themes_0.2-1_all.deb' pidgin-themes_0.2-1_all.deb 1473898 MD5Sum:203e296d8352a3b80ddaff613aa44ea4

Please note that, this will only work for packages which are not installed. For installed ones, it will simply exit after notifying that the package is already installed.

1 Comment

Anonymous Coward (not verified)
January 17th, 2011 07:54 pm
You could extend your script to work for packages that are already installed by adding the --reinstall flag. By using the -qq flag you can also avoid interactive questions and related clutter. Now we've got something that can be postprocessed easily.

# example: print just the urls
sudo apt-get install -qq --reinstall --print-uris bash | cut --delimiter=" " -f1

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.