Search for .bashrc or other dotfiles in Finder
When I search for files in my home folder that have a filename equal to ".bash_history"
, I don't get any results, even though that file is there. How can I search for dotfiles in Finder? (I know how to find them in the terminal, however, some programs such as Integrated Development Environments have an open dialog that forces you to go through the Finder to locate the file you want to open).
Solution 1:
In pretty much any Open or Save dialog in OSX Yosemite (and several previous versions) you can type shift + ⌘ commmd + . to make invisible files visible within the dialog.
So you can easily open TextEdit (or any given app).
Type ⌘ command + O.
Type shift + ⌘ command + . to reveal invisibles.
Type shift + ⌘ command + G in the Open Dialog and enter ~ (tilde) in the Go-To field to navigate to your home directory.
Type . + P to get to .profile or very close thereto.
Or as AMR says if you know it you can paste the whole path to the desired file in the Go-To field and get directly to it.
If necessary you can always display invisible files in the Finder itself. I've got this function in ~/.profile
to toggle them on/off.
#--------------------------------------------------------------------
# Task: Finder — Toggle All-Files-Visible On/Off
# dMod: 2015/07/29 02:48
# Test: Yosemite
#--------------------------------------------------------------------
function toglffvis()
{
if [ $(defaults read com.apple.finder AppleShowAllFiles) = 1 ]; then
defaults write com.apple.finder AppleShowAllFiles -boolean false
else
defaults write com.apple.finder AppleShowAllFiles -boolean true
fi
sleep 0.2;
killall Finder;
}
#--------------------------------------------------------------------