5

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).

2
  • 1
    The dot files aren't hidden at the file system level. This is an historical Unix naming convention. Hence the Finder should give a way to access them easily rather than to let people think there is any protection associated with these files. This is a Finder conceptual bug and should be repeatedly explained to Apple.
    – athena
    Commented Jul 25, 2015 at 14:35
  • @danielAzuelos Apple's perspective probably is that for people who don't know enough to find these, then they don't want them touching them because messing up even one can cause a world of grief, and for those that do know how to find them and what they are, they will use the shell. Bash ls, at least in the Mac version of it still has .<filenames> as hidden. You need to add -a to be able to see them in the terminal.
    – AMR
    Commented Jul 26, 2015 at 0:20

2 Answers 2

5

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;

}

#--------------------------------------------------------------------
1
  • In Mavericks 10.9.5, shift + ⌘ command + . doesn't do anything in open windows (for me, at least). I do have AppleShowAllFiles enabled, but it still does not show up in the open file window.
    – Myer
    Commented Feb 2, 2016 at 14:29
0

.<filename> is designated as a hidden file for OS X and Finder's search and Spotlight will not find them, even if you have made your hidden files visible.

You can however use the Terminal to find the location of the file. Use:

find ~ -name ".bashrc"

Highlight and copy the path that is returned.

Then in the IDE dialog press shift + ⌘ command + G to display the Go input box.

Paste your path and filename there and you should be good to go.

Note: If you don't want to see all of the warnings of directories that your user account does not have access to, especially if you are running find on your root find /, then you can run it with sudo and that will avoid all of the Permission Denied warnings about searching locked directories.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .