Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

How to find stuff on your Mac hard drives


Overview

Here are my notes on finding (and replacing) stuff on a Mac.

Windows

https://www.makeuseof.com/tag/search-file-contents-windows/

Hidden files

If you are searching for hidden files:

How to Search the Content of Your Files on Windows

Using Command line

  1. cd to the path

  2. To find text “Exception” within files of “.md” type at the current folders down:

    find . –name “*.md” –print | xargs grep “Exception”

Find “foo” within files by diving recursively into folders :

grep -ri “foo” .

Remove the i to not ignore case distinctions.

Display print only the filenames with GNU grep:

grep -r -l “foo” .

https://www.cyberciti.biz/faq/howto-recursively-search-all-files-for-words/

Use -print0 option to find filenames that contain spaces or other metacharacters:

find /path/to/dir -type f -print0 xargs -0 grep -l “foo”

Find file names

Find files using file-name ( case in-sensitve find)

find -iname “MyCProgram.c”

Execute commands on files found by the find command

find -iname “MyCProgram.c” -exec md5sum {} \;

Find all empty files in home directory

find ~ -empty

More find examples: http://www.thegeekstuff.com/2009/03/15-practical-linux-find-command-examples/ Mommy, I found it! — 15 Practical Linux Find Command Examples

Using Utility programs

KDiff3

Using IDE

If you’re working in an IDE, it’s simpler