Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

How should I locate all 32bit programs on my system ? I'm running a 64bit OS.

(There might be some , but I forget)

share|improve this question
up vote 1 down vote accepted

This is kinda crude, but should do the trick

find / -mount -type f -perm /111 -exec sh -c 'objdump -f {} | grep -q elf32 && echo {}' \;
  • -mount keeps us on the / filesystem
  • -type f restricts it to files only
  • -perm /111 restricts it to files with the executable bit
  • then we run objdump -f on the file and echo the file name if objdump contains elf32

The first 3 filters are just so we narrow the results a bit and arent running objdump on every single thing.

share|improve this answer
1) find $(echo $PATH|sed -e 's/:/ /g') will make it faster go; 2) -mount is kinda obsolete, it's -xdev now; 3) objdump takes bunch of files okay, so it's better feed it with them, reducing costs of exec calls: objdump -f /bin/echo /bin/date |fgrep elf64/bin/echo: file format elf64-x86-64 /bin/date: file format elf64-x86-64 – poige Jun 13 '12 at 3:58
Yeah, forgotten my favorite: avoid using grep when fgrep suffices — unix.stackexchange.com/questions/21020/… – poige Jun 13 '12 at 4:00
poige, you should issue your own answer with those modifications. – Jodie C Jun 13 '12 at 4:50
@poige (1) restricts it too much in my opinion, -mount is more compatible than -xdev, doing it a file at a time makes it cleaner to show just the matching file name. – Patrick Jun 13 '12 at 12:03
If you guys want to keep arguing about this, take it to chat; comments aren't good for this sort of thing – Michael Mrozek Jun 14 '12 at 17:19

This will take forever:

find /|parallel -n100 file {}|grep "ELF 32.*executable"

It should work though. You'll need to make sure you have GNU parallel installed

share|improve this answer
Running in parallel isn't a good idea here: this is an I/O-bound task, having multiple processes competing for the filesystem is more likely to slow the execution down. If you have several disks, you can get a speedup by running a separate find for each disk. Even with RAID-1, find is competing with file to some extent, but maybe parallel -n2 file would speed up a little. – Gilles Jun 14 '12 at 0:13
parallel -n100 won't spin off 100 tasks, it will only run one at a time sequentially, and give at most 100 arguments to each instance. See the max-args option in the GNU parallel man page – Jodie C Jun 14 '12 at 1:01
Oh, sorry, yes. No point in invoking parallel if you're not going to use parallelism though. – Gilles Jun 14 '12 at 1:06
Parallel has much better handling of special filenames. For instance, find /|xargs -n100 -i file {} would throw errors on the first filename with a single quote in it, while GNU parallel will happily plod along. – Jodie C Jun 14 '12 at 1:09
find / -exec file {} + – Gilles Jun 14 '12 at 1:10

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.