Saturday, January 30, 2010

Show/Hide System Files

toolsI had a post in 2008 about "Show/Hide Hidden Files". Here I found another tool which contains this feature as well: TinkerTool, which is free as well. It has the same with to enable/disable "Show hidden and system files" in Finder tab and a button to relaunch Finder.

Most Mac tool applications actually have some scripts behind it. Quickly, I found out that there is a setting to make Finder to display system files: AppleShowAllFiles in default settings. This can be verified in a Terminal:

[MyMac]~ [user]$ defaults read | grep Apple
    AppleShowAllFiles = 0;

The default setting value is 0, which means disabling Show hidden and system files. To set this enabled, type the following command:

[MyMac]~ [user]$ defaults write AppleShowAllFiles 1

To verify its value, you may use alternative way to read value:

[MyMac]~ [user]$ defaults read AppleShowAllFiles

The Finder would not immediately be able to show hidden files. It has to be relaunched. One way to launch it is to Force Quit from Apple menu:

The short-cut key for this Command+Option+esc, then select Finder to relaunch it. The above snap-shot actually shows the wrong keys when I tried to take a snap of this menu by using Command+shift+4 key. The Force Quit... becomes Force Quit Finder with extra key shift. Manu shortcut keys are very handy. This Apple support web page lists Mac shortcut keys.

To relaunch Finder in command scripts, you can use ps and grep to find the current Finder process id,

[MyMac]~ [user]$ ps -ax | grep Finder
2357 ??     0:00.21 /System/Library/CoreServices/

and then use Kill and Open to relaunch it (your Finder process id may be different):

[MyMac]~ [user]$ kill 2357 && open /System/Library/CoreServices/

Notice, the application Finder is within the package, and you just need to use package to launch it.

No comments: