key combo to toggle showing hidden items
Solution 1:
I don't think you can do this by default.
I myself use Hidden Files widget. it's so easy to use.
Solution 2:
You can do it with two small shell scripts:
This will reveal the "invisible" files:
#!/bin/sh
# make invisible files visible
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
This will hide the "invisible" files made visible:
#!/bin/sh
# make visible files invisible
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
Save each into an appropriately named file, set their executable bits using chmod
, then you can run them to set or unset the visibility.
Alternately, you could use the following code, and toggle back and forth by executing the code repeatedly:
#!/bin/sh
showFiles=`defaults read com.apple.finder AppleShowAllFiles`
if [ "$showFiles" = 1 ]
then defaults write com.apple.finder AppleShowAllFiles -bool FALSE
else defaults write com.apple.finder AppleShowAllFiles -bool TRUE
fi
killall Finder
Solution 3:
I have an AppleScript I use to toggle things like these off and on:
http://www.markdouma.com/developer/ToggleInvisibleFiles.zip
The code:
property showAllFiles : missing value -- missing value is AppleScript equivalent of nil or NULL
try
set showAllFiles to (do shell script "/usr/bin/defaults read -g AppleShowAllFiles")
on error
set showAllFiles to "0"
end try
tell application "Finder" to quit
if showAllFiles = "0" then
do shell script "/usr/bin/defaults write -g AppleShowAllFiles 1"
say "AppleShowAllFiles 1"
--say "Now showing invisible files"
else if (showAllFiles = "1") then
do shell script "/usr/bin/defaults write -g AppleShowAllFiles 0"
say "AppleShowAllFiles 0"
--say "Now hiding invisible files"
end if
tell application "Finder" to activate
(Note, you can open up the downloaded AppleScript by dragging it to the icon of AppleScript Editor.app).
I generally prefer to tell applications to quit rather than kill them (though, with the sudden termination feature introduced in 10.6, that can sometimes be the same thing).
Oh, mine differs from Greg's in that I set it for the global preference domain (so that it affects all apps, including the Open and Save dialogs). (Though you can always toggle invisible files off or on in Open or Save panels using Command-Shift-period ).