Blog

CuTt: Find file’s fullpath

Copper’s Tips & Tricks #1: Find file’s fullpath

Two ways to do this, the normal way, using `find`, and the hipster way, using `tree` and `grep`:

The normal way
find . -name '[filename].[extension]'

# E.g.:

$ find . -name 'wp-config.php'

./Documents/Sites/some-project/workspace/some-beep/wordpress/wp-config-sample.php
./Documents/Sites/some-project/workspace/some-beep/wordpress/wp-config.php
./Documents/Sites/some-project/workspace/some-boop/wordpress/wp-config-sample.php
./Documents/Sites/some-project/workspace/some-boop/wordpress/wp-config.php
./Documents/Sites/some-project/workspace/some-noise/wordpress/wp-config-sample.php
./Documents/Sites/some-project/workspace/some-noise/wordpress/wp-config.php
./Documents/Sites/some-project/workspace/some-censured/wordpress/wp-config-sample.php
./Documents/Sites/some-project/workspace/some-censured/wordpress/wp-config.php
The hipster way
$ tree -fi | grep SiteSettings
./wordpress/wp-content/themes/example/models/App_SiteSettings.php

Why use tree and grep when you have find??? Good question! Mostly because pipe grep is more instinctive than find, and easier to remember “tree fi grep” than “find dot SINGLEdash name”, I find myself using tldr all the time for find, non-pipe grep, and tar all the time.

This is arguably the least useful tip and trick, but, looking on the bright side, it’s also the MOST useful as of this writing, because it’s the first and only one! Protip: Call your gf “my prettiest gf” if you dislike lying

Leave a Comment