So this is the first in what will be an ongoing series of articles involving the utility called Terminal. Terminal, also known as the command line, offers you direct access to the Unix bedrock of Mac OS X. To some, it is very familiar territory. There are network admins and power users who use terminal a lot all the time.
At the other end of the spectrum are most of the rest of us. Terminal is something we’ve heard about, or maybe even used once or twice, usually with some trepidation due to the dire caveats of doom that people who write articles about terminal make very prominent. With good reason — you can certainly get into lots of trouble. (Like erasing your whole drive instead of emptying your trash or overwriting your iPhoto library with that hilarious picture from funnycats.org that you downloaded for reasons even you don’t fully understand.)
With these and many other scenarios there is no undo or undelete, and I can’t count the number of support calls I have taken that start “OK, so I was messing around in Terminal…” That being said, many really destructive actions require a special command and an admin password, which should at least make you stop and think about what you are doing. We see this in the regular OS environment all the time, but it goes a step further in Terminal. In the normal Aqua environment, you are still protected somewhat — there are things you simply are not allowed to do, even as an admin user.
However, there are tons of things you can do to get comfortable with Terminal that are pretty safe. The basic format of Terminal commands is a command followed by modifiers and variables such as the commands which will show all the invisible files on your machines. Let’s give it a try.
Open a Terminal window. Copy and paste the following into the window:
defaults write com.apple.Finder AppleShowAllFiles TRUE
To be able to see this, you will need to relaunch Finder, like so:
killall Finder
Now if you look in the Finder you will see all the normally hidden folders visible and accessible but grayed out.
Reversing this command is as simple as entering the first command again, changing TRUE to FALSE.
defaults write com.apple.Finder AppleShowAllFiles FALSE
Relaunch Finder again, and the files will be hidden once again.
killall Finder
Hopefully you were able to follow along and see this happen. The point I wanted to make is that you see how easy it is to reverse this change by changing the variable. Remember NOT ALL CHANGES ARE REVERSIBLE — especially removing and deleting — and a good backup is critical for mucking around with a powerful tool like terminal.
If you think about it, what we did above is basically change a Finder preference — the difference is that you are doing it in Terminal since this option is not listed in the Finder preferences in the GUI. This is actually one of the most common uses of Terminal by non-professionals. There is a world of hidden system preferences that you can access from the Terminal which will let you customize your machine in a myriad of ways.
Here is a link to a Macworld article that has 25 easy Terminal tips.
We’ll be back next week with more!