Viewing and Editing Files

Viewing and Editing Files

All the commands mentioned here are covered in more detail in Chapter 5 and Chapter 6, "Editing and Printing Files"; we covered nano in Chapter 2.

Viewing files

The less , cat , head , and tail commands (described below) are all used for viewing files. For more detailed information on these four commands, see Chapter 5.

less The less command is a pager a utility for viewing a long stream of text one screen (or page ) at a time. When you are viewing a Unix man page, you are seeing it paged through less .

cat The cat command is used to combine ( concatenate ) files together. It is frequently used to simply display an entire file without pausing.

You can think of cat as a way of displaying short files, and less for displaying long files.

head The head command is used to show just the beginning of a file or other output.

tail If head shows the beginning, can you guess what tail does?

Editing files

The three most common Unix tools for editing text files are vi , emacs , and nano . We'll cover these in more detail in Chapter 6.

vi vi is a full-featured command-line text editor. It is found on virtually every Unix system and is the primary editing tool we cover in this book.

emacs emacs is another full-featured text editor and has far more features than vi (including a built-in adventure game). Many programmers prefer emacs to vi , and the debate over which editor is best sometimes seems religious rather than rational.

nano This is a fairly simple text editor. It is intended to work like another simple editor called pico (the Pine Composer), and in versions of Mac OS X prior to 10.4 pico was supplied instead of nano . nano has a less restrictive license than pico .



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

Similar book on Amazon

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