Running GUI and CLI Applications


There are two kinds of applications you'll be using under FreeBSD: GUI (Graphical User Interface) applications, which run within the context of an X11 user environment such as KDE or GNOME, and CLI (Command Line Interface) applications, which run in text mode and operate within a terminal window or the system console.

CLI applications are the most commonly used in the UNIX world; they include text editors such as ee and vi, email programs such as Pine, and textual web browsers such as Lynx. When you run a CLI program, you type its name at a shell prompt, and the program generally takes over the entire context of your terminal, whether it's the full screen of the system console, a terminal window invoked within your X11 session, or a Telnet or SSH session where you're accessing the FreeBSD system from a remote computer. Local or remote terminal windows in a desktop GUI (such as an SSH client on a Windows machine) can be resized to any dimensions, and a CLI program running within that window will generally resize its workspace to fit; but the default size for a terminal window, and the size of the physical console screen, is 80 columns wide by 25 lines tall. The program dominates your shell session until you quit it, at which point it returns you to the shell prompt.

Tip

If you're working at the local console, remember that you can switch from one virtual terminal to another by pressing Alt+F2, Alt+F3, and so on. This can be very useful if you need to perform command-line operations in one screen while simultaneously editing a file or reading your email in another one.


Note

Your path is a list of directories, specified in your shell configuration file (.cshrc or .profile), that tells the shell where it should look for programs whose name you type at the command line. Your path, by default, contains directories such as /usr/bin, /usr/sbin, and /usr/local/bin; because most third-party applications get installed into /usr/local/bin, the shell will find them there if you simply type a program's name at the prompt. However, if a program you want to run isn't found in any of the directories in your path, you need to launch it by specifying its entire path, for example:

# /home/frank/myapp


For safety reasons, your path by default does not include your home directory or the current directory (denoted with a dot or period). To execute a program located within the current directory, such as a shell program you're writing, use the ./ prefix:

# ./myscript.sh


Refer to Chapter 9, "Customizing the Shell," for more information about the shell configuration files.


A GUI application can be launched in any of several ways, depending on what kind of desktop GUI you have. The simplest way to invoke a GUI application in an X11 session is to type the program's name at a shell prompt within a terminal window (such as KTerm in KDE); when you do this, the program creates its own window within the desktop environment, along with its own menus and palette windows if necessary. The terminal window from which you launched the program, however, becomes useless until you exit the program; keyboard input is suspended and ignored, and the shell prompt doesn't reappear until you use the program's Exit function or press Ctrl+C at the command line (this key combination usually terminates any program you executed at that command line).

A more elegant way to launch GUI applications from a terminal window is to use the & character after the program's name; this tells the shell to detach from the process you're executing, place it in the background, and return to an interactive prompt:

# mozilla &


This syntax allows you to keep working within your terminal window while launching new, independent GUI applications that aren't tied to it and don't depend on the terminal window remaining open.

These techniques are useful if you're using a plain window manager such as Window Maker, as discussed in Chapter 5. If you're using KDE or GNOME, however, you have a couple of additional, even better ways to launch GUI applications. KDE and GNOME both have facilities for adding programs, along with their icons, into the K menu (in KDE) or the Applications menu (in GNOME), so that you can navigate graphically to them in their appropriate categories and launch them just as you would in Windows. If the program you want to launch isn't found in these menus, though, you can use KDE's Run Command function, found in the K menu and shown in Figure 6.1, to specify a program by name and run it independently, free of any terminal windows. GNOME's equivalent function is available in the Applications menu and called Run Application. Other window managers, such as Window Maker, have the same functionality as well, although the vocabulary varies (in Window Maker it's Run...).

Figure 6.1. The Run Command dialog box in KDE. The equivalent function in GNOME is Run Application.


Tip

Both GNOME and KDE include the facility to add a command launcher to the quick-access panel, which can allow you to launch your applications even more directly.





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

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