Manipulating Commands

The Unix shell can make your command time more productive in a slew of different ways. The shell can keep track of the commands you’ve run, help you fix typos you’ve made, and even let you create entirely new commands with ease.

The Master List of Commands and Programs

Want to see a list of every Unix command Terminal knows about—its master vocabulary of magic words? (Well, read on anyway.)

At the prompt, press the Tab key (you may need to press it twice). Terminal asks if you want really want to display all 983 possibilities (your number of commands may be different) and asks you to type y (for yes) or n (for no). If you type y, Terminal displays a list of every executable program on your computer—hundreds and hundreds of them, most of which explain themselves when you use the man command ( Section 15.9.1).

Create a List of All Your Files

Really, all of them. Every single one, in one list, with just one command in Terminal. This way, if you’re on the hunt for a particular file, you don’t have to search until you’re blue in the face. It’s the ultimate in one-stop viewing.

Navigate to your Home folder in Terminal (type cd and press Enter if you’re not already there), then type:

ls -RF

The -R flag drills down into all subfolders. The -F flag, meanwhile, writes a trailing slash (/) after folders, and a trailing asterisk (*) after programs, to make it easy to see what kind of files you have at a glance.

Note

This list can be very, very long. If you have lots of files, ...

Get Mac OS X Power Hound, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.