The (slow) Linux “find” command has an option, “-ls”, to display size, date, etc. like the “ls -l” command. But the “locate” command doesn’t seem to have that. So how can I get the equivalent functionality with locate?
I’ve used back-ticks to pass the output of locate to ls, like this:
ls -al `locate -e somefile`
…which works as long as somefile exists. But if somefile doesn’t exist, it gives me a full directory listing.
If I do this:
ls -al `locate -e somefile` thisfileneverexists
…then it sort of works, if you don’t mind the error line:
ls: cannot access thisfileneverexists: No such file or directory
…which leads us to the obvious-but-extremely-ugly workaround:
ls -al `locate -e somefile` thisfileneverexists 2>/dev/nul
That works, but surely there’s a better way!