19

What is Ubuntu's CTRL+H equivalent in OSX Lion Finder to toggle display hidden files?

My all searches point me to use: defaults write com.apple.finder AppleShowAllFiles TRUE which is not exactly the same and its effect is somewhat permanent.

1
  • 1
    As of macOS 10.12, Finder supports ⇧⌘. to do this. Commented Dec 7, 2016 at 16:58

7 Answers 7

8

There is a simple keyboard shortcut, at least since Sierra (macOS 10.12). Ensure that Finder is the active app and use this keyboard shortcut:

CommandShift. (that's a full stop/period at the end)

1
  • This keyboard shortcut does not work with international keyboards in Finder window, although it works in open file dialogs. At least with French keyboard. Commented Feb 25, 2021 at 10:34
16

⇧⌘. shows hidden files in file dialogs and in some third party applications like TotalFinder. Transmit also has a menu item for toggling hidden files, but it's assigned to ⇧⌘B by default.

There's nothing equivalent to that in Finder though. But you could assign a shortcut to a script like this with FastScripts or by creating an Automator service.

k="com.apple.finder AppleShowAllFiles"
[[ "$(defaults read $k)" == 0 ]] && b=true || b=false
defaults write $k -bool $b
osascript -e 'quit app "Finder"' && open -a Finder

6
  • taking this one step further... add a service to show/hide hidden files from an Automator workflow. see hints.macworld.com/article.php?story=20100719001040829
    – libjack
    Commented Dec 1, 2011 at 21:23
  • @libjack I edited the answer to add instructions for creating an Automator service as well.
    – Lri
    Commented Dec 1, 2011 at 23:09
  • 1
    This does not work on Mountain Lion! Any ideas why?
    – Mohamad
    Commented Oct 10, 2012 at 16:42
  • @Mohamad The activate event seemed to time out part of the time. I replaced it with a shell script.
    – Lri
    Commented Oct 10, 2012 at 20:39
  • Thanks. I'll try this out and report back if I have any issues!
    – Mohamad
    Commented Oct 10, 2012 at 20:59
7

defaults write com.apple.finder AppleShowAllFiles FALSE reverse it. And there is no such functionality (online hide/show without restart) built in into Finder.

That is probaly because anyone who need it will prefer ls -a anyway.) BTW If you only need to list hidden files use ls -ld .??*

4
  • 3
    +1 for that funny command that I've never seen before .??*
    – gentmatt
    Commented Nov 30, 2011 at 20:40
  • @Matt I am myself a bit of terminal monkey because I'm using many of commands and arguments without full understanding but rather found them as they are when they were needed and keep on using them in their original form =) Your comment prompted me to look into this arguments when I have a bit more time though (I wonder why there are two ?? and then wild card too) but for now it works for me). But if you can give me a link plainly explaining arguments for unix commands that would be sweet)
    – iskra
    Commented Nov 30, 2011 at 21:45
  • well as far as i understand .??* would search for files starting with a . and at least two characters in the name. You could use .* as well to list all hidden files. But that's not the point. I was looking to show/hide files in the finder without switching to terminal each time. You would know this if you have tried poor/free ubuntu :)
    – kunal
    Commented Dec 1, 2011 at 19:39
  • a slightly better (but harder to type) pattern would be .[^.]* -- forces the second character to be anything except for dot
    – libjack
    Commented Dec 1, 2011 at 21:26
3

You could buy TotalFinder. It is a finder replacement that supports this feature (and many other nice features like tabs). TotalFinder features the . shortcut as seen here:

Hidden Files Example

See more details about this particular feature on their site

2

The keyboard shortcut CommandShift. does not work with international keyboards in Finder window, although it works in "open file" dialogs.

At least this is true with French keyboard.

The shortcut to use then is fnCommandShift. It works in both "open file" dialogs and in Finder windows, however you can avoid pressing the extra key fn and use CommandShift. in those dialogs.

0

Wow, the above sounds really complex, why not open a terminal, and

  • type defaults write com.apple.Finder AppleShowAllFiles YES and press return
  • Now Ctrl-Opt-Click on the Finder icon and select Relaunch

To un-hide run defaults write com.apple.Finder AppleShowAllFiles NO the same way.

3
  • 2
    It's a bit more work to setup but much easier to use afterwards, especially if you are not using Terminal.app a lot.
    – nohillside
    Commented Jun 24, 2012 at 17:15
  • Why not? Because the questioner specifically asked to be able to do it with a keyboard shortcut.
    – calum_b
    Commented Jun 30, 2017 at 11:14
  • and because We can assure the user wants to be able to toggle between the two modes. Commented Feb 25, 2021 at 10:43
0

Here's a tutorial for setting up a contextual menu item to toggle visibility of hidden files.

http://www.macosxtips.co.uk/index_files/quickly-show-hidden-files.php

Still not as good as a keyboard shortcut. Filing a duplicate of radar://7096650 at http://bugreport.apple.com is the best way to tell Apple that you want this feature.

You must log in to answer this question.

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