a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by Devac
Devac  ·  3080 days ago  ·  link  ·    ·  parent  ·  post: Taking the headphone jack off phones is user-hostile and stupid

I have already suggested it to steve, but I think that I should share it with everyone. However, this comes with caveat that I have never really used Apple products. It works on Linux and similar systems, but I'm not sure to what degree it applies to Apple.

First of all, to my knowledge, the only files and links to files are considered as executable system-wide without knowing the direct location are the ones located in the $PATH environment variable. You can see it with from your console:

  echo $PATH

Now, you can either go around and look in these directories or use:

  locate -ir "/some/path/" partial_file_name

to see all of the possible results. It obeys all of the typical regular expressions (regerx) for both path and file name. The -i flag tells locate to ignore case, so there will be no difference between /usr/bin/Network_APP and /usr/bin/network_app if your query was

  locate -ir "/usr/bin" net*

I hope that helps. Main benefit of using locate instead of find command is the lack of rather obtuse syntax, plus it eliminates the need for additional search with grep in my experience. Plus it's really fast.

added: By the way, you don't have to specify path. But in that case you might end up having to browse through quite a lot of results. If that's the case consider something like:

  locate partial_name | less

that will make it that much easier to browse. I think it can be universally ended by ctrl + C or escape key or just by pressing Q for quit.





steve  ·  3080 days ago  ·  link  ·  

Thanks again for the tip Devac!

if you're going to use it in OS X - you'll need to build the database first.

  $ locate ?

  WARNING: The locate database (/var/db/locate.database) does not exist.

To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

  Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

http://osxdaily.com/2011/11/02/enable-and-use-the-locate-command-in-the-mac-os-x-terminal/

Devac  ·  3080 days ago  ·  link  ·  

No problem, I hope that it will help at least some of you guys :D. Does the $PATH thing work?

am_Unition  ·  3080 days ago  ·  link  ·  

Yeah, in fact, that's how I found out that my /bin/ folder was still inside the /opt/ folder, which had vanished from the GUI "Finder" file tree. I still use Finder to shuffle around a bunch of data files because I'm still developing a system and don't have a naming convention yet.

Anyway, thanks for dat knowledge. Apple has a pretty good tool (Spotlight Search) that does exactly what those lines of code do, with a little less hassle, but fewer options.

I'm still with 'bl00, probably hopping off the Apple bandwagon next purchase. I spent a lot of money, and now it just feels like I'm getting dicked around too often. Transitioning to Linux will be something I can only afford to do when I'm not entrenched in a daily grind. Hopefully it's this side of my thesis.

Devac  ·  3080 days ago  ·  link  ·  
This comment has been deleted.
user-inactivated  ·  3080 days ago  ·  link  ·  

    Main benefit of using locate instead of find command is the lack of rather obtuse syntax, plus it eliminates the need for additional search with grep in my experience.

Are you using -name and then greping? -regex matches the filename against a regular expression instead of a glob, but it might be a gnu extension.

Devac  ·  3080 days ago  ·  link  ·  

Oh, cool. I seem to forget about that all the time, thanks for reminding me about that :D. In general I don't find find (heh) as helpful as locate though. Sometimes I can't escape -regex + grep afterwards when I'm searching for something fancy. My regex-fu is not that strong ;). Locate is a bit easier for me to use so I went with that, that's all. But I do retract part of my reason for recommending locate in place of find since I was misremembering the utility.

Thanks again!