klyde
klyde

Reputation: 215

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 ?

Upvotes: 15

Views: 7080

Answers (5)

durum
durum

Reputation: 3404

rga (ripgrep-all) allows to search over dozens of data formats (text, audio, and video) and builds a cache/index. Runs on Linux and it is in most distributions package managers (apt, pacman, etc).

Upvotes: 1

slm
slm

Reputation: 16416

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.

Upvotes: 8

Murray
Murray

Reputation: 21

sudo ls -Rla / | grep regexOrNameOfSomethingYouAreLookingFor &

Best to put this in the BG as it can take a while. Also focussing it to a specific location or the WD speeds it up tremendously:

sudo ls -Rla ~/Documents/ | grep regexOrNameOfSomethingYouAreLookingFor

Upvotes: 0

ephemient
ephemient

Reputation: 204798

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.

Upvotes: 9

Keltia
Keltia

Reputation: 14743

Not really, none of the other UNIX system have an indexer builtin the file system (except BeOS but it is not a UNIX system and mostly dead anyway). You can have something not too far with the locate(1) command on all BSD systems (the daily script create the locate database with locate.updatedb) but this is only enables you to find pathnames. It does not deal with metadata such as keywords and file types.

To be honest, this is one of the best things amongs others about MacOS X, just live with it :)

Upvotes: 4

Related Questions