Mastering™ Linux

Mastering™ Linux

SYBEX Sample Chapter Mastering™ Linux Arman Danesh and Michael Jang Chapter 9: Using Applications with GNOME and X Windows Copyright © 2001 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. No part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic or other record, without the prior agreement and written permission of the publisher. ISBN: 0-7821-2915-3 SYBEX and the SYBEX logo are either registered trademarks or trademarks of SYBEX Inc. in the USA and other countries. TRADEMARKS: Sybex has attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer. Copyrights and trademarks of all products and services listed or described herein are property of their respective owners and companies. All rules and laws pertaining to said copyrights and trademarks are inferred. This document may contain images, text, trademarks, logos, and/or other material owned by third parties. All rights reserved. Such material may not be copied, distributed, transmitted, or stored without the express, prior, written consent of the owner. The author and publisher have made their best efforts to prepare this book, and the content is based upon final release software whenever possible. Portions of the manuscript may be based upon pre-release versions supplied by software manufacturers. The author and the publisher make no representation or warranties of any kind with regard to the completeness or accuracy of the contents herein and accept no liability of any kind including but not limited to performance, merchantability, fitness for any particular purpose, or any losses or damages of any kind caused or alleged to be caused directly or indirectly from this book. SYBEX Inc. 1151 Marina Village Pkwy. Alameda, CA 94501 USA Phone: 510-523-8233 www.sybex.com 2915ch09.qxd 04/19/01 3:37 PM Page 161 CHAPTER NINE 9 Using Applications with GNOME and X Windows ■ Using Xterm ■ Customizing Xterm ■ X Windows Applications ■ X Windows Utilities 2915ch09.qxd 04/19/01 3:37 PM Page 162 162 Chapter 9 • Using Applications with GNOME and X Windows This chapter looks at some X Windows and GNOME applications and how they can be run and used within the GNOME desktop. These applications include xterm, the GNOME file manager (called Midnight Commander), a graphics pro- gram called The GIMP, and several X Windows utilities. These applications have been selected based on one of two criteria: They are useful in everyday Linux operations, or they are representative of the power or range of many Linux applications. This chapter should give you the confidence to begin experimenting with other X Windows applications. Using Xterm While X Windows puts a nice-looking and user-friendly face on Linux and allows the creation of fully graphical applications, the fact remains that as a Unix clone, Linux is a command-line-oriented operating system. Although it is possible to use Linux for everyday work without ever using the command prompt, to take advantage of the real power and flexibility of a Unix- like operating system, you need to make at least occasional forays into the world of the command line. Fortunately, this doesn’t mean abandoning the ease of X Windows. The xterm program provides a command prompt window that is fully integrated into the X Windows environment, with a scroll bar, a resizable window, and the ability to copy and paste with other X Windows applications—all features that a standard Linux console lacks. NOTE You can launch an xterm window in Red Hat Linux 7 by selecting Regular XTerm from the System submenu of the Programs menu. GNOME includes a clone of xterm, known as GNOME terminal. Nevertheless, this chapter describes xterm in detail, because it is available in other Linux graphical environments, including KDE. Many of the same commands work for GNOME terminal; some require slight changes such as an extra dash. Only significant functional differences between these two types of terminals are noted in this chapter. 2915ch09.qxd 04/19/01 3:37 PM Page 163 Using Xterm 163 If you want to launch additional xterm windows, you can also do so from the command line of another xterm window using the command $ xterm & or, if you find that for some reason xterm isn’t on your path, use the command $ /usr/X11R6/bin/xterm & TIP You can locate most files easily with the locate command. If you want to find the directory where xterm is located, run the locate xterm command. Unfortu- nately, locate doesn’t work with recently created or moved files; in that case, use the find command as described in Chapter 13, “Introducing Linux Commands.” Alternatively, you can launch additional GNOME terminal windows from the command line of another xterm window using the command $ gnome-terminal & or you can just click the terminal icon on the default GNOME panel. By default, this opens a window that is 80 characters wide and 24 lines deep with a scroll bar. The window can be resized to provide more space for viewing information and working. As shown in Figure 9.1, the default color scheme for new xterm windows in Red Hat Linux 7 is black characters on a white back- ground. The default title of the window specifies the current user and directory. FIGURE 9.1: An xterm window 2915ch09.qxd 04/19/01 3:37 PM Page 164 164 Chapter 9 • Using Applications with GNOME and X Windows Customizing Xterm The xterm program is highly customizable. Among other things, you can change the following characteristics: • The window’s font • The color scheme • The default window size • The placement of new windows on the screen • The title of the window This section will look at these options and describe how to use them when launching new xterm windows. At first it might seem that this flexibility has no real value, but in reality it does. On different monitors, different color combinations produce the most readable text, so being able to change the color scheme is a valuable feature. Also, if you regularly use several xterm windows for different tasks (such as running top for managing system performance, reading your e-mail, and managing your files), being able to quickly identify which window is currently being used for which task makes switching between open windows much easier. Flags and Arguments: A Quick Unix Primer Before going forward, you need a quick tutorial about how Unix commands work. A com- plete introduction to Unix and Unix commands as used in Linux comes in Chapter 13. To execute a program (or command), you simply need to type the name of the program (and possibly the complete location of the program) and press the Enter key. For instance, to launch xterm, you can use the command $ xterm or, if the directory where xterm is located is not on your path, use the command $ /usr/X11R6/bin/xterm The path is where Linux searches for commands. You can find the path with this command: $ echo $PATH Continued on next page 2915ch09.qxd 04/19/01 3:37 PM Page 165 Customizing Xterm 165 Most programs either require or can accept information that alters the way they behave or provides information to be processed. Two types of information can be provided to a com- mand: flags and arguments. Arguments are information provided to the program to be processed; they can be any- thing from filenames to text to search for. Flags are options that alter the behavior of a program. They appear after the command, separated by one or more spaces and preceded by a dash. For instance, the flag -help causes xterm to print out a help message: $ xterm -help usage: xterm -options ... -e command args where options include: -help print out this message -display display name X server to contact -geometry geom size (in characters) and position -/+rv turn on/off reverse video -bg color background color -fg color foreground color -bd color border color -bw number border width in pixels -fn fontname normal text font -iconic start iconic -name string client instance, icon, and title strings -title string title string -xrm resourcestring additional resource specifications -/+132 turn on/off column switch inhibiting -/+ah turn on/off always highlight -/+ai turn on/off active icon Complex flags can also be created to provide information that the flag needs to function correctly. For instance, to set the xterm title, you use the -T flag, but you also need to pro- vide the text that you want to appear in the title bar. The command $ xterm -T Email creates an xterm window with the word Email as the title. On the other hand, one simple flag is the ampersand (&). For example, the command Continued on next page 2915ch09.qxd 04/19/01 3:37 PM Page 166 166 Chapter 9 • Using Applications with GNOME and X Windows $ xterm & opens another xterm window and returns the current xterm window to the command- line interface. Arguments, on the other hand, are not configuration options but information provided to a program to be processed. Arguments are not preceded by a dash as are flags. Argu- ments are often the names of files to be opened, processed, or edited—as in the follow- ing example, which indicates that the file testfile should be opened for editing with the editor emacs: $ emacs testfile Setting the Color Scheme Using a variety of flags, it is possible to set almost all aspects of an xterm win- dow’s color scheme from border color to the color of the cursor.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    32 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us