Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Over the time I installed many i386 packages, which I no longer need. How can I clean up the system and stay only with the amd64 packages?

share|improve this question
up vote 10 down vote accepted

If they are not in your way, I would leave them where they are.
If you insist on deletion, use dpkg -l | grep i386 to create a list of i386-packages. You can delete these after careful checking with something like sudo apt-get purge <package-name>.

share|improve this answer
Except that aptitude is broken on multiarch, so that won't work so well :P – tumbleweed Mar 19 '12 at 19:43
apt-get purge <package-name> should still work, though. – Eliah Kagan Jun 15 '12 at 9:53
"after careful checking" -- that is vague. Please be more clear. – kevinarpe Feb 9 '14 at 11:06

I blitzed all my 32bit packages like this:

sudo apt-get remove `dpkg --get-selections | grep i386 | awk '{print $1}'`
share|improve this answer
how to make these kind of commands, i know apt-get and grep but whats awk'{print $1}', just want to know. – Sushantp606 Nov 27 '13 at 2:07
awesome, and I was able to remove the i386 architecture now, but when I do dpkg -l | grep i386 to check the packages are still there any ideas, also +1 for the previouse comment and my guess it's related to shell scripting techniques – Ismail Marmoush Jan 10 '14 at 12:07
No responses probably because comments aren't the place for an awk tutorial. That bit of awk is printing only the first field of each line being piped in. Awk's default field separator is a space, " ". – rthbound Jan 15 at 17:45

The upper automated solutions are dangerous and not always working (1), so here another way

sudo aptitude purge `dpkg --get-selections | grep ":i386" | awk '{print $1}'`


sudo apt-get purge `dpkg --get-selections | grep ":i386" | awk '{print $1}'`

(Try to use always and only one of the tools. Since aptitude is better when having dependency trouble, I prefer that.)

Good idea to also

dpkg --remove-architecture i386

and maybe

dpkg --print-foreign-architectures

(1) The former commands also lists packages having only i386 in their name (although they are for 64bit architecture), the regular expression didn't work and dpkg shows packages which are already removed, but still have configuration files left (dpkg -l shows "rc" instead of "ii" as status).

share|improve this answer

In case anyone is wondering, there's a much more sane and graceful way to do this. The last previous answer hopes to do the same thing, but that search fails since architectures are not actually part of package names, except in special cases.

as root (or with sudo) run:

aptitude remove ~i~ri386

If you don't use aptitude over apt-get already, do. It's really excellent. You can find a list of aptitude's search terms here.

share|improve this answer

Here is another way that is even lower risk:

apt-get remove "^.*:i386$"

This will specifically match only packages ending with ":i386", which is the standard naming convention for all i386 architecture Debian packages.

share|improve this answer
why remove over purge? – Lotus Oct 7 '15 at 15:16
@Lotus: I am unaware of the difference. Can you please explain? Maybe we can update this answer to improve it. – kevinarpe Oct 8 '15 at 1:41
purge takes the configuration files also and any remant directories iirc – Lotus Oct 8 '15 at 2:11
@Lotus I used purge and it worked on 14.04. This only worked for me after removing the quotation marks and carret. sudo apt-get purge .*:i386 – Antonios Hadjigeorgalis Mar 9 at 17:25

Your Answer


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.