Chapter 6. Editing and Printing Files


Learning how to edit text files from the command line is the second most important Unix skill, right after learning how to use the command line itself. That's because text files form the basis of many activities we'll cover later in this book. Unix uses text files to store the vast majority of system configurations. Most system-administration tasks involve editing text files. Installing Unix software often requires you to edit a text file or two, and the scripts you create are also text files.

Text files in Unix are all stored as plain-text files. That is, there is no font, color , sizing, style, or other formatting information stored in the file. Unix text files are intended to be displayed using a monospaced font, so that every character takes up the same amount of space on the line. Unix uses a different end-of-line character than Macintosh programs use, so a text file created in a Macintosh word processor will look strange when viewed in a Unix text editor. (Some Macintosh programs, such as BBEdit, offer the option to save files with Unix-style line endings.)

In Chapter 2, "Using the Command Line," you used a simple Unix text editor called nano to edit a file from the command line. nano is a fine editor for casual editing of text files, but for a variety of reasons (such as difficulty in handling very long lines), it is not the best choice for performing serious Unix administration work, such as editing system-configuration files. In order to properly perform Unix system-administration tasks, you need to use a more powerful text editor.

There are two standard powerful Unix text editors, vi and emacs . Mac OS X comes with both of them. In this book we are going to show you some basic vi skills because vi is more widely available on different Unix systems. (See the sidebar "BBEditan Excellent Text Editor," for a useful Mac-centric solution.)

Once you know how to create and edit files from the command line, you will of course be curious about how to print them. At the end of this chapter we'll show you a couple of ways to do this.



Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net