Chapter 2. Using Solaris Editors


Of all the topics described in this book, new users dislike the topic of Solaris editors the most. Some of the Solaris editors are painfully difficult to learn and require a great deal of practice before a user can become comfortable using them. To complicate things even more, several editors are available in Solaris to choose from that can be used to create and edit ASCII text files:

  • ed A line-oriented editor. ed is the original UNIX text editor.

  • red A restricted version of ed.

  • edit The edit utility is a variant of the text editor ex and is recommended for new or casual users who want to use a command-oriented editor.

  • sed A noninteractive text editor

  • ex A superset of ed.

  • vi A full-screen (visual), display-oriented editor based on ex.

  • view The view invocation is the same as vi except that the read-only flag is set.

  • vedit The vedit invocation is intended for beginners. It is the same as vi except that the report flag is set to 1, the show mode and novice flags are set, and magic is turned off. These defaults make it easier to learn how to use vi.

  • vipw This edits the password file while setting the appropriate locks and does any necessary processing after the password file is unlocked. vipw performs a number of consistency checks on the password entry for root and will not allow a password file with a “mangled” root entry to be installed. It also checks the /etc/shells file to verify the login shell for root.

  • dtpad A GUI editor available in Common Desktop Environment (CDE).

ed was the original editor developed for UNIX, and it is still used today by some UNIX hardliners. Because it is a line-oriented editor, it is difficult to see the entire file you are editing. After ed came the ex editor. The most notable advantage of ex over ed was a display-editing facility that enabled users to work with a full screen of text instead of just one line at a time. While using the ex editor, you could get into the full-screen display, referred to as the “visual mode,” of ex by entering the ex command vi. Users started using the visual display mode of ex so much that developers of ex made it possible to start the ex editor so that the user entered the visual display mode immediately without entering the vi mode command. The new facility was named vi. You can still use the ex editor today and issue the vi command to get into visual mode, just as within the vi facility you can go back to the line–oriented mode of ex.

Although this chapter focuses primarily on the vi editor, understanding the history behind the vi editor will make some of the concepts a bit clearer. You’ll find the UNIX editors, with the exception of the GUI-based editors, difficult to master. It’s important for the system administrator to be proficient in vi for several reasons:

  • You might not always have access to a graphics (bit-mapped) terminal. Therefore, a GUI-based editor will not work.

  • You might need to work on a Solaris system across a telnet connection. A GUI-based editor will not work in a telnet connection.

  • You might need to work on a Solaris system when the windowing environment (that is, CDE) is not running.

The scenarios I’ve outlined are more the norm than the exception for a system administrator. You will be spending a great deal of time building and rebuilding the Solaris environment on your systems. This involves editing many configuration files. You cannot afford to stumble when using the vi editor as you work to get a system back up and running. Failure to become efficient in the vi editor could be detrimental to performing your tasks as a system administrator.

One further note: It’s important to understand the difference between a text editor and a word processor. Text editors work on text (ASCII) files, which are commonly used for programming and system configuration files. Word processing deals with textual information with an emphasis on appearance. In a word processor, you can control fonts, specify margins, and insert graphics. There is no standard word processor in Solaris, although a few commercial products are available that can be added to the Solaris environment, one of which is found in Star Office (Sun’s office suite of packages that consists of word processing, spreadsheet, presentation, graphics, and database software).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset