Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mdfind equivalent on linux?

Mac OS X is a beautiful system, from the mach kernel up to finder and spotlight and speaking of spotlight, it truly blew me away when I just needed to execute this command to get all unix executables and ONLY unix executales:

mdfind "kMDItemKind == 'Unix Executable'"

Amazing!!! Really!!!

Now, the question is does anyone know of an equivalent unix or linux command that doesn't involve complex find incantations or doesn't return false positives (like someone perming all their images rwxrwxrwx ?

like image 316
klyde Avatar asked Jan 26 '09 00:01

klyde


2 Answers

Beagle, MetaTracker, Strigi, and even Google Desktop are all desktop indexers for Linux. What's there by default depends on your distribution (some may have none at all), and they all have different tools and interfaces, but the first three support Xesam, so xesam-tool can provide a mdfind-like command-line interface.

like image 154
ephemient Avatar answered Oct 17 '22 23:10

ephemient


There are 3 ways to go about this under Linux.

1. use a location tool

You can use the commands locate, which, and whereis to find programs and files matching a pattern on your system.

2. executables are kept in designated areas

90% of the executables on a Linux system are either installed under /usr/bin, /usr/sbin, /bin, or /sbin so it isn't really a mystery what executables are available.

3. use find

Use find to locate files that have their executable bits set (--x--x--x).

% find . -executable -type f

4. use your package manager

You could also use your Linux distros' package manager (yum, apt, etc.) to find out what executables are installed for either a given package or all the packages installed.

like image 8
slm Avatar answered Oct 18 '22 00:10

slm