Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Essentially what I'm looking for is the Debian equivalent of:

yum list available

to show me which packages are available (though not currently installed). I'd prefer something that can be run from the console as this is on a remote server. Thanks.

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

grep-dctrl and its derivatives provide a great way to query the apt cache files. (You can install these tools on ubuntu with sudo apt-get install dctrl-tools )

In the case of available (but not necessarily installed) packages, you can use grep-available. For example, to list all available packages:

grep-available  -s Package .

Edit:

aptitude can show you a list of Not Installed Packages by just launching it.

You can also get a list of not installed packages with aptitude by using:

aptitude -F "%p" search "?not(?installed)"

Note that with the new multi-arch packages, you'll get packages for other architectures listed in this result. For example, I get:

aptitude -F "%p" search "?not(?installed)"  | grep "^bash:"
bash:i386

I have the bash package installed, but it's the amd64 version, since my OS is installed with the amd64 version of Ubuntu Precise. If you don't want to see these packages for other architectures, you can exclude lines containing ::

aptitude -F "%p" search "?not(?installed)"  | grep -v ':'
share|improve this answer
    
Thanks but the problem with this is I'd have to trawl through the entire package lists for my chosen repositories. Perhaps a better way to visualize the problem would be thus: imagine X being the universal set of all packages in the Debian package repositories my server is pointed to and Y being the set of packages I have installed on said server; what, in essence, I seek is X - Y. Now, I realize I can do this programmatically but I'd hoped there would be a relatively simple command to achieve the same result on a Debian system. –  freakwincy Apr 3 '12 at 20:45
    
Just saw your edited answer. Its exactly what I was looking for! Thanks. –  freakwincy Apr 4 '12 at 10:33
    
You're welcome. –  ℝaphink Apr 4 '12 at 10:33
    
P.S. I'd have up-voted your answer but I haven't accumulated enough reputation points yet. –  freakwincy Apr 4 '12 at 10:36
    
No problem. Welcome to SU by the way ;-) –  ℝaphink Apr 4 '12 at 10:37
add comment

apt-cache is used for querying the package cache:

apt-cache pkgnames | sort
apt-cache search thing
apt-cache search --names-only thing
share|improve this answer
    
thanks but I'm afraid that doesn't work. I compared the list generated by the first command with a previously generated list of installed packages which I derived thus: code "dpkg --get-selections | grep '[[:space:]]install$' | awk '{print $1}' > installed.txt" and found duplicates. The other two commands you provided won't work because I'm not searching for a particular package but rather any package that is not currently installed. –  freakwincy Apr 3 '12 at 20:09
add comment

Use apt-cache for this purpose:

apt-cache search package

Since apt-cache only uses the package cache on the system, make sure that this cache is up to date:

apt-get update

You can also use the utility apt-file if you know the name of a file you want to search for; this has to be added to the system however. For example:

apt-file search somefilename

I tend to use apt-cache in one of the following ways:

apt-cache search package | sort | grep item

(This shows you things that have item actually in their summary or names.)

apt-cache search thing | sort | less

(This searches for thing then sorts it for pleasant viewing with less.)

share|improve this answer
add comment

Taking your question strictly (you want to show a list of not installed packages), try using

(edited according to comments below)

# apt-get update
# dpkg -l '*' | egrep --invert-match '^i'

Not sure of the exact syntax though, as I'm writing this on a windows box and no way to check. Maybe try to change what you grep on

share|improve this answer
    
This lists installed packages, not uninstalled. –  ℝaphink Apr 3 '12 at 16:50
    
@Raphink: Sorry, I edited the post to fix this –  PPC Apr 3 '12 at 18:25
    
No problem, but you're still not listing packages that are not installed. By excluding 'ii' packages (which is actually not really what your expression does, you should use '^ii' rather than '[ii]'), you're missing on packages that are installed but not configured for example (like iF or iH for example). –  ℝaphink Apr 3 '12 at 20:06
    
@PPC: Alas, this doesn't work either as dpkg -l only lists installed packages i.e. the all the packages are prefaced by "ii" so piping the results to grep using the --invert-match or -v flags only yields a series of dashes which is the list header separator. Thanks anyway. –  freakwincy Apr 3 '12 at 20:25
    
@ freakwincy: Right! Sorry for not testing it before sending (working on windows). According to manpage, you should use "dpkg -l '*'" to list all packages. –  PPC Apr 3 '12 at 20:30
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.