When you use a program, you’ll want to know how to control it. How can you tell it what job you want done? Do you give instructions before the program starts, or after it’s started? There are several general ways to give commands on a Mac OS X system. It’s good to be aware of them.
- Graphical programs
Some programs work only within the graphical window environment (on Mac OS X, this is called Aqua). On Mac OS X, you can run these programs using the
open
command. For instance, when you typeopen -a Chess
at a shell prompt, the chess game starts. It opens one or more windows on your screen. The program has its own way to receive your commands — through menus and buttons on its windows, for instance. Although you can’t interact with these programs using traditional Unix utilities, Mac OS X includes theosascript
utility, which lets you run AppleScript commands from the Unix shell.- Non-interactive Unix programs
You’ve also seen in Section 1.2 that you can enter many Unix commands at a shell prompt. These programs work in a window system (from a Terminal window) or from any terminal. You control those programs from the Unix command line — that is, by typing options and arguments from a shell prompt before you start the program. After you start the program, wait for it to finish; you generally don’t interact with it.
- Interactive Unix programs
Some Unix programs that work in the terminal window have commands of their own. (If you’d like some examples, see Chapter 2 and Chapter 3.) These programs may accept options and arguments on their command lines. But, once you start a program, it prints its own prompt and/or menus, and it understands its own commands; it takes instructions from your keyboard that weren’t given on its command line.
For instance, if you enter
ftp
at a shell prompt, you’ll see a new prompt from theftp
program. Enter FTP commands to transfer files to and from remote systems. When you enter the special commandquit
to quit theftp
program,ftp
will stop prompting you. Then you’ll get another shell prompt, where you can enter other Unix commands.
Get Learning Unix for Mac OS X, 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.