- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Introduction
- Part I: Introduction to Mac OS X
- Chapter 1. Mac OS X Component Architecture
- Chapter 2. Installing Mac OS X
- Chapter 3. Mac OS X Basics
- Chapter 4. The Finder: Working with Files and Applications
- Chapter 5. Running Classic Mac OS Applications
- Part II: Inside Mac OS X
- Chapter 6. Native Utilities and Applications
- Chapter 7. Internet Communications
- Chapter 8. Installing Third-Party Applications
- Part III: User-Level OS X Configuration
- Chapter 9. Network Setup
- Chapter 10. Printer and Font Management
- Chapter 11. Additional System Components
- Part IV: Introduction to BSD Applications
- Chapter 12. Introducing the BSD Subsystem
- Chapter 13. Common Unix Shell Commands: File Operations
- Part V: Advanced Command-Line Concepts
- Chapter 14. Advanced Shell Concepts and Commands
- Chapter 15. Command-Line Applications and Application Suites
- Chapter 16. Command-Line Software Installation
- Chapter 17. Troubleshooting Software Installs, and Compiling and Debugging Manually
- Chapter 18. Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)
- Part VI: Server/Network Administration
- Chapter 19. X Window System Applications
- Chapter 20. Command-Line Configuration and Administration
- Chapter 21. AppleScript
- Chapter 22. Perl Scripting and SQL Connectivity
- Chapter 23. File and Resource Sharing with NetInfo
- Chapter 24. User Management and Machine Clustering
- Chapter 25. FTP Serving
- Chapter 26. Remote Access and Administration
- Chapter 27. Web Serving
- Part VII: Server Health
- Chapter 28. Web Programming
- Chapter 29. Creating a Mail Server
- Chapter 30. Accessing and Serving a Windows Network
- Chapter 31. Server Security and Advanced Network Configuration
- Chapter 32. System Maintenance
- Appendix A. Command-Line Reference
- Appendix B. Administration Reference
Using Terminal.app
The Terminal program, found in the utilities subfolder of the Applications folder, is the primary method for communicating with the BSD subsystem of the OS X installation, via the Unix command line. Some tricks and nifty applications are already appearing to insulate you from the need to work with the command line for some applications. We will cover these as well, but the terminal itself will probably be your primary mode of interaction.
Simply put, Terminal.app is the "terminal" by which you can type commands to your machine. It's the software version of what used to be implemented as a dedicated hardware device that understood how to display data and put it in specific positions on a screen. A terminal itself isn't particularly interesting, but provides the mechanism for communication between you and programs that are more interesting to talk to.
Terminal Preferences
As with most OS X GUI tools, a number of things about Terminal.app can be customized. Because you're probably familiar with configuring GUI apps by now, we'll just hit the highlights and give you an overview of what is configured where.
Across the top of the preferences panel, you have a number of panes from which to choose. These include
- The General pane, shown in Figure 12.1, enables you to configure the font and the number of character rows and columns shown in the terminal. It also allows configuration of the behavior of the terminal window when the shell or application running in it exits.
Figure 12.1 The General pane of the preferences panel for Terminal.app.
- The Startup pane, shown in Figure 12.2, allows you to configure the behavior of Term
i
nal.app on startup. Most interestingly, you can configure a file to be executed when the terminal starts. Unfortunately, we don't discuss what sort of things might be put into a startup file until Chapter 18, "Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)."
Figure 12.2 The Startup pane of the preferences panel for Terminal.app.
- The Shell pane, shown in Figure 12.3, lets you configure the shell to use for interaction in the terminal. Because everything we show in this book is in tcsh, we recommend that you leave the Shell field set to tcsh. Leaving the shell configured to read the login script is probably a good idea as well. This will control whether each terminal executes the /etc/csh.login script and your home directory ~/.login script.
Figure 12.3 The Shell pane of the preferences panel for Terminal.app.
- The Emulation pane, shown in Figure 12.4, lets you configure whether to translate newlines to carriage returns for pasted text; in other words, to convert from Mac-like text into Unix-like text. In addition, you can configure whether to generate VT100 keycodes from the numeric keypad. You can control the behavior of the Alt key, but because Unix doesn't frequently make use of any of the three features suggested, the best setting for this will depend on the applications you choose to run in your terminals. Text editors, in particular, might like you to have VT100 keycodes enabled so that you can use the numeric keypad to move around in your document.
Figure 12.4 The Emulation pane of the preferences panel for Terminal.app.
- The Display pane, shown in Figure 12.5, lets you enable the scrollback buffer (do it!), and set how many lines to keep. We suggest you use many, many lines! We couldn't live with less than a 3000-line scrollback buffer. As memory and disk space become cheaper every day, you'll probably find that you want, and can use, even more. Whether to wrap and rewrap lines is your choice, as is whether you want the terminal to scroll to the bottom when you enter data into it.
Figure 12.5 The Display pane of the preferences panel for Terminal.app.
- The Title Bar pane, shown in Figure 12.6, lets you control the information that appears in the title bar. For your convenience, it shows you a picture of what your title bar will look like with the selected options.
Figure 12.6 The Title Bar pane of the preferences panel for Terminal.app.
- The Colors pane, shown in Figure 12.7, lets you configure the colors and characteristics of many features of the terminal. The most obvious are the window background and the selection color. Next, you can configure how text should look, the type of cursor you want, and whether the cursor blinks. Conveniently, the pane shows you the effect of your choices before you okay them by Sdisplaying the label text for each option in the style selected for it.
Figure 12.7 The Colors pane of the preferences panel for Terminal.app.
- The Activity pane, shown in Figure 12.8, has the least obvious function. As you'll learn in this chapter, Unix commands run "in" terminals, so closing a terminal when the application running "in" it is still active can have undesirable results. If you enable activity monitoring, the terminal will try to monitor whether there are any applications running in the terminal, and warn you if closing the terminal will kill any applications. If you enable the "Clean" background processes check box, the terminal will attempt to guess whether processes that are running without an obvious interface can safely continue without the terminal. It's not clear how well this works at this point in time.
Figure 12.8 The Activity pane of the preferences panel for Terminal.app.
The Save and Save As items are accessible from the Shell menu. These allow you to save the setup and preferences of a Terminal.app window or window set.
Also accessible are the Save Text As and Save Selected Text As items. These allow you to save the complete text buffer of the terminal, or whatever text you have selected in the terminal. The Run Command option of the Shell menu produces the dialog box in which you can enter a command to run in a new terminal window.
If the command doesn't produce an interactive environment, the new window will just tell you that the command ran, which isn't very useful. If the command is an interactive one such as emacs (emacs is a very powerful text editor that you'll learn about in Chapter 15, "Command-Line Applications and Application Suites"), it will produce a new window and run the specified command in that window.
The Shell menu item Set Title seems like a preferences option. In fact, if you select it, you get yet another way to control the window's behavior. This menu item and the Inspector menu item bring up the Terminal Inspector, which gives you access to most of the same preferences options as the preferences panel. The biggest difference seems to be that the Terminal Inspector and Preferences panel are different shapes.
Most of the items in the Edit menu are familiar. The Find item, however, leads to an option to bring up the Find panel, from which you can search for data in the Terminal's buffer.
The Font and Windows menus have the properties you already expect, and the Control menu shows you the options you have for cursor control in the window. Additionally, this menu includes the option to send a Break signal to the terminal, which can be invaluable for stopping a program that has gone awry without taking the drastic step of closing the terminal.
Interacting with Unix: Basic Unix Commands | Next Section

Account Sign In
View your cart