Using X-Windows

Note: This documentation is somewhat out-of-date in many places.
The X-terminals that directly connect to utstat run the X-windows system. X-windows manages the screen, allowing you to have several “windows” that can be running independent programs, or that are even connected to different computers. X-windows also supports the use of fancy fonts and graphics. It is also possible to use X-windows from home, via a modem connection.

If you want to do sophisticated things with X-windows, you’ll need to read one of the many books on it, some of which can be found in the U of T bookstore. Most users won’t need to know all the details, however. This page gives a few hints on how to do everyday things. See also “man X” for some introductory documentation.

Contents of this page:

  • Startup for X-windows
  • Creating and manipulating windows
  • Grabbing text with the mouse
  • Some useful X-windows programs
  • Connecting to or from other computers
  • Setting things up the way you like

Startup for X-windows

After logging in at an X-terminal, you will see a single “window” on the screen (unless you have set things up differently yourself). If you position the movable “cursor” in this window by moving the mouse, you will be able to to type commands, and see the results within this window. On most terminals, you can get right to work at this point, or create more windows as described below.

However, on some very old terminals, or if you log in using the F1 or F2 key (see logging in and out at an X-terminal), or if you somehow logged in through telnet rather than the usual X-windows login window, you may need to start up a “window manager” manually. The “window manager” lets you move around windows, resize them, destroy them, etc. You would normally start a window manager by typing the xstart command, which will also create more windows for you if you have set things up to do so as described in setting up X-windows to your liking.

The standard window manager that we use is twm, described in detail in “man twm”. If necessary, you can start twm explicitly with the command

twm &

but this is not normally required, unless twm crashes for some reason.

Creating and manipulating windows

You can use the window manager to create windows, move them around, and delete them, using the mouse. To get a menu of operations, depress the right mouse button when pointing at a clear area of the screen (outside any window). You select an item by moving the pointer to it, and then releasing the button. Unless you’ve changed things (see setting up X-windows), the menu you get should have the following items (plus some others):

 

New xterm

This will create a new xterm window, in which you can type commands to the shell, just like in the first window that you got when you logged in. (You can also start an xterm window by typing a command, see below). When the window is created, you will have to specify where on the screen it should go by moving the frame shown to the desired spont and then pressing a mouse button (different mouse buttons give slightly different effects).

Kill

When you select this, the cursor will change to a skull-and-crossbones. You can move this to point to a window, and then press another mouse button to delete the window and kill the program it is running. Point instead to some empty part of the screen if you don’t want to kill anything.

Close

This works like “Kill”, except it just deletes the window from the screen, without necessarily killing the program. (If the program has only one window, however, it usually terminates when that window is closed.)

Exit

This menu item terminates the window manager. You would normally do this only when logging out (see logging in and out at an X-terminal). To prevent accidents, you can’t select this item in the normal way. Instead, after moving the mouse to “Exit”, you have to slide it to the right until a secondary menu appears, then move it to “Select if you’re sure”, and finally the release the button.

There are also menu items for moving windows, changing their size and shape, and so forth, but it is usually easier to do these operations by pointing with the mouse at the little icons in the title bars of the windows. Try playing around with the various mouse buttons.

Grabbing text with the mouse

You can use the mouse to grab text that is visible on the screen, and feed it to a program as if you had typed it.

For example, suppose that you typed a command in one window, and now want to issue the same command in another window. As long as the first command is still visible, you can grab it by pressing the left mouse button when pointing at the start of the text of the command, sweeping the mouse to the end of the text (while still holding down the left button), and then releasing the button. The text you have grabbed should be highlighted. You can then move the cursor to the other window and click the middle mouse button. The text you grabbed will appear there as if you had typed it.

When repeating commands within a window, the line editing commands are often quicker, provided the program you are using supports them.

Some useful X-windows programs

Many programs have been written to run under X-windows. Some of them are found in the directories /usr/bin/X11 and /local/bin, usually under names starting with “x”. You can get information on these programs using the man command. Some general information can be obtained from “man X”.

Here are a few of the more useful X-windows programs:

 

xterm

Creates a new window that emulates an ordinary terminal, on which it runs a “shell” program. This is like being logged in another time (particularly if you use the -ls option, which makes it go through the usual motions of logging in). You can do completely separate things in each of the xterm windows that you have on the screen.

nedit

Creates a new window that runs a mouse-based text editor. Other editos (eg, emacs) may also create their own window to run in.

xclock

Creates a new window that displays a clock.

xcalc

Creates a little window that looks (and acts) like a calculator.

xzap

Lets you easily terminate programs that you started but now want to kill. See killing programs.

Some programs documented elsewhere also run in their own X-window, such as netscape, ghostview, and xmaple.
You can start these programs by just typing them as a command to any shell that you are running. You will usually want them to run in the background, so you should put an “&” at the end of the command line.

For example:

xclock -geometry 75×77 &

creates a clock. Here, the -geometry option has been used to say how big it should be; most X-windows programs have many options for controlling such things.
You can create windows that run ordinary Unix programs using xterm with a -e option to run a program other than the shell. For example:

xterm -e vi &

will start up a window running the vi text editor.
Normally, you would stop these programs in whatever way they provide, but if all else fails, you can kill them using the “Kill” option of the twm menu, which you get by depressing the right mouse button in a clear area of the screen. When you see the skull and crossbones, move it to the window you want to kill, and press the mouse button again.

 

Connecting to or from other computers

You may sometimes want to log in to another Unix computer through an X-terminal connected to utstat, or to connect to utstat from an X-terminal attached to another Unix computer. In both cases, you may need to tell the remote computer how to find the X-terminal, and to tell the X-terminal to allow access from the other computer.

Here’s an example of how this is done when connecting to another computer from an X-terminal attached to utstat (though not all of this may actually be necessary):

 

echo $DISPLAY
xhost +
telnet other-computer
Type username and password for account on other-computer
DISPLAY=address-found-above
export DISPLAY
Do your stuff, then log out

The first command should print out the value of the DISPLAY variable, which identifies your X-terminal; this should be something like xterm-z.utstat.utoronto.ca:0. The “xhost +” command then tells your X-terminal that it should accept connections from any other computer. (WARNING: This does open you up to possible security problems.) When you then remotely log in to the other computer, you will need to tell it how to find your X-terminal. This is done by setting the DISPLAY variable on the remote computer to what you found it to be with the first command. It may, however, be necessary to make the address more explicit, eg, by adding .utstat.utoronto.ca if it isn’t already included.

If you use a C-shell-like shell on the remote machine, you should set the DISPLAY variable with “setenv DISPLAY address” instead of the “DISPLAY=” and “export” commands above.

When you connect to utstat from elsewhere, you’ll need to do the same thing as above, but with the roles of utstat and the other computer reversed.

Since telnet (though not the similar rlogin program) attempts to set DISPLAY properly, you may not always need to do the stuff involving DISPLAY above. The xhost + command will be unnecessary if full access is the default.

Print Friendly