Common Desktop Environment: User's Guide

# 12 Using Terminal

Contents of Chapter:

Default Desktop Terminal Emulator
  Starting a Terminal Window
    To Start a Terminal Window from the Front Panel
    To Start a Terminal Window from Application Manager
    To Start a Terminal Window from File Manager
    To Start a Terminal Window from the Window Menu
    To Close a Terminal Window

Using a Terminal Window
  To Start Applications in a Terminal Window
  To Enter a Command
  To Copy and Paste Text
  To Resize the Window Contents

Running dtterm on Another System
  Using the -display Option
  Using rlogin
  Using rsh

Customizing dtterm
  Displaying the Menu Bar
    To Remove the Menu Bar
    To Restore the Menu Bar
  Displaying the Scroll Bar
    To Display the Scroll Bar
  dtterm Global Options
    To Determine Cursor Style
    To Determine Cursor Blinking
    To Set the Cursor Blink Rate
    To Switch Foreground and Background Colors (Color Control)
    To Determine Scroll Behavior
    To Set the Bell Type
    To Set the Margin Warning
    To Set the Margin Distance
  dtterm Terminal Options
    To Set the Cursor Key Mode
    To Set the Keypad Mode
    To Determine the Newline Sequence
    To Set the User Function Keys
    To Set 132 Column Switching
    To Set End-of-Line Wrapping
    To Set Reverse End-of-Line Wrapping

Terminal Control Characters
  To Set Terminal Control Characters

Changing the Default Terminal Emulator

A terminal emulator displays a window that allows you to enter operating system commands, use UNIX commands, and copy and paste text.

Note: Illustrations shown in this chapter were taken from the default CDE screens. Your screens may be different from the illustrations if you or your system administrator have customized them.

## Default Desktop Terminal Emulator

The default terminal emulator on the desktop is `dtterm` . The `dtterm` terminal emulator emulates that portion of the VT220 terminal that is consistent with ANSI and ISO standards.

The `dtterm` command-line prompt is a special character that is displayed in the left margin of your terminal emulator. It can be a ``%'', ``<`', ``$'', or another special character. A small box or bar, called a cursor , shows where characters will appear in the window when you type something on the keyboard.

### Starting a Terminal Window

There are several ways you can start a Terminal window:

- From the Front Panel
- From Application Manager
- From File Manager
- From the Window menu
- From an existing Terminal window

#### To Start a Terminal Window from the Front Panel

1. Click the arrow above the Text Editor control (or the control that appears as the second one to the left of the workspace switches) in the Front Panel

2. Click the Terminal control in the Personal Applications subpanel.

The default Terminal window appears.

#### To Start a Terminal Window from Application Manager

1. Click the Application Manager control on the Front Panel.

2. Double-click Desktop_Apps to open the Desktop_Apps group.

3. Double-click the Terminal icon (you may have to scroll down to see it).

#### To Start a Terminal Window from File Manager

1. Click the File Manager control on the Front Panel.

   The File Manager window appears.

2. Choose Open Terminal from the File Manager File menu.

#### To Start a Terminal Window from the Window Menu

Choose New from the Window menu of an existing Terminal window.

  An exact replica of the Terminal window appears.

### To Close a Terminal Window

Type `exit` at the command line and press Return.

- Or, choose Exit from the Terminal Window menu.

- Or, choose Close from the Window menu (displayed through the button at the upper left of the window frame).

Note: Typing `exit` at the command line is the preferred method of closing `a` Terminal window. The other two methods don't terminate any background processes you may have started, which can sometimes cause problems.

If you started the Terminal window from a command line, you can stop it by pressing Control+C in the window from which you started it.

## Using a Terminal Window

The Terminal window provides a means to start other applications, enter UNIX commands, and copy and paste text between and within windows.

### To Start Applications in a Terminal Window

Type the command to start the application at the command-line prompt.

The general syntax for starting an application is:

    application [options] &

application
  The application name

options
  A list of optional information to be passed to the application

&
  Indicates that the application runs in the background; that is, you can continue to use the Terminal window while the application is also running

Refer to the man page or other documentation for each application to find the command and options to use for that application.

##### Example

To start a digital clock from the command line, type

    xclock -digital &

### To Enter a Command

Type the command and press Return.

##### Examples

To obtain a list of the files in the current directory, type:

    ls [Return]

To obtain a list of the files in the current directory and print it on the default printer, type:

    ls | lp [Return]

### To Copy and Paste Text

1. Use mouse button 1 and drag over the text you want to move.

   The text appears highlighted.

2. Release mouse button 1 after all the text you want is highlighted.

   The highlighted text is copied to an internal clipboard where it is kept until another copy occurs. The text is not removed from your original source.

3. Click mouse button 2 where you want to insert the text.

   A copy of the contents of the clipboard is pasted at the location you indicated. You can make additional copies by repeating the above steps.

### To Resize the Window Contents

When you change the size of a Terminal window, applications running in the window may not know about the resizing. Use this procedure to resize the application's output.

To resize the window contents, type the following at the command-line prompt:

      eval `resize`

Note that resize is enclosed within a set of single close quotation marks rather than double quotation marks.

## Running dtterm on Another System

You can run `dtterm` on another system through various commands:

- The `-display` option
- The `rlogin` command
- The `rsh` command

### Using the -display Option

    -display host:display[.screen]

where

host
  The name of a valid system on the network.

display
  The number of the display on the host.

screen
  Optional. The screen within the display. The default is 0.

You can find these values by typing `env`, and examining the DISPLAY line. The terminal emulator is running on your system, but the window shows on another system.

##### Example

The following command starts a `dtterm` window on the host computer named `hpcvxdm`:

    dtterm -display hpcvxdm:0 &

### Using rlogin

You can use `rlogin` in an existing Terminal window to log in to a remote host. Once the window is acting as a terminal to the remote host, you can run applications there, redirecting the display back to your system if you desire.

For example, the following command logs onto a system named `there` , runs the client `xload` , and redirects the display back to your original system. Assume your system is named `here` .

    rlogin there
    xload -display here:0

### Using rsh

The `rsh` command starts a shell on a remote host, performs some client (often starting a terminal emulator on that host), and redirects the display back to your original system if desired.

It has the syntax:

    rsh remote -n client -display system:display[.screen]

where:

remote
  The remote host name

client
  The program you want to run on the remote host

system:display[.screen]
  The host and display on which the results are to be displayed

The `rsh` command is often used when customizing a menu to access other hosts.

##### Example

The following command runs `xload` on the remote host named `there`, and directs output back to your system, `here`.

    rsh there -n /usr/bin/X11/xload -display here:0.0 &

## Customizing dtterm

There are several ways in which you can customize `dtterm`:

- Run it with special options, such as the menu bar and scroll bar

- Run the terminal emulator on another system

- Change global options such as cursor style and background color

- Change terminal options such as keyboard and screen control

### Displaying the Menu Bar

By default, `dtterm` appears with a menu bar. You can remove it if you wish.

#### To Remove the Menu Bar

Choose Menu Bar from the Options menu.

  The menu bar disappears from the `dtterm` window.

#### To Restore the Menu Bar

1. Click mouse button 3 anywhere within the `dtterm` window.

   A pop-up menu appears containing items identical to those of the menu bar.

2. Choose Menu Bar from the Options menu.

   The menu bar appears at the top of the `dtterm` window.

### Displaying the Scroll Bar

By default, `dtterm` appears without a scroll bar.

#### To Display the Scroll Bar

Choose Scroll Bar from the Options menu.

  The scroll bar appears in the `dtterm` window.

  To remove the scroll bar from the window, choose Scroll Bar from the Options menu again.

### dtterm Global Options

There are four areas that you can control from the Global Options dialog box:

- Cursor control
- Color control
- Scroll behavior
- Bell control

To display the Global Options dialog box, choose Global from the Options menu.

#### Cursor Control

You can control three aspects of the `dtterm` cursor:

- Cursor style
- Blinking cursor
- Blink rate

#### To Determine Cursor Style

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Cursor Style button and choose the cursor style option you want:
   - Box (the default)
   - Underline
   - None (the cursor is invisible)

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

The changes you make will be visible on existing `dtterm` windows; you don't have to start a new one.

#### To Determine Cursor Blinking

The `dtterm` cursor blinks by default. You can turn off the blinking or change the blink rate (see "To Set the Cursor Blink Rate").

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Blinking Cursor button in the Cursor Control section and choose to either have the cursor blink (Enabled) or not blink (Disabled).

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

Note that when this option is set to Disabled, the Blink Rate option and text field are both inactive and appear dimmed.

#### To Set the Cursor Blink Rate

The blink rate determines how often the `dtterm` window's cursor blinks. The default blink rate is 250 milliseconds. To change the cursor blink rate:

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. In the Blink Rate text field, type the value in milliseconds you want.

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

The changes you make will be visible on existing `dtterm` windows; you don't have to start a new one.

#### To Switch Foreground and Background Colors (Color Control)

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Window Background button in the Color Control section and choose the color display you want:
   - Normal displays the foreground and background colors normally.
   - Inverse switches the foreground and background colors.

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Determine Scroll Behavior

Smooth scrolling displays each line sent to the Terminal window immediately, rather than storing it in a buffer. This results in scrolling that is more pleasing to the eye, but is slower. The default is smooth scrolling disabled. To enable smooth scrolling:

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Smooth Scrolling button and choose the type of scrolling you want:
   - Disabled (the default) disables smooth scrolling.
   - Enabled starts smooth scrolling.

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### Bell Control

There are three types of Bell Control options in `dtterm`:

- Bell type
- Margin warning
- Margin distance

#### To Set the Bell Type

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Bell Type button in the Bell Control section and choose the type of bell you want:
   - Audible (the default) causes the bell to make a sound.
   - Visible causes the bell to blink the background color.

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Set the Margin Warning

The Margin Warning option is used in conjunction with the Margin Distance option to warn the user either visually or aurally that the cursor is within a specified distance from the right margin. To set the margin warning:

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click the Margin Warning button in the Bell Control section.

3. Choose Enabled or Disabled.

4. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

Note that the Margin Distance option (see "To Set the Margin Distance") is inactive when Margin Warning is disabled.

#### To Set the Margin Distance

The Margin Distance option is only active when the Margin Warning option is set to Enabled. You set the distance from the right margin of the `dtterm` window at which you want the bell to ring (or appear, if Bell Type is set to Visible). The default value is 10 characters.

To change the distance:

1. If the Global Options dialog box is not displayed, choose Global from the Options menu.

2. Click inside the Margin Distance text field in the Bell Control area and type the number of characters from the right margin of the window at which you want the margin warning to be issued.

3. Click OK at the bottom of the Global Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

The changes you make will be visible on existing `dtterm` windows; you don't have to start a new one.

### dtterm Terminal Options

There are two areas that you can control from the Terminal Options dialog box:

- Keyboard control
- Screen control

To display the Terminal Options dialog box, choose Terminal from the Options menu.

Changes you make through the Terminal Options dialog box are effective on existing `dtterm` windows; you don't have to start a new one.

#### Keyboard Control

You can control four aspects of your keyboard through the Terminal Options dialog box:

- Cursor key mode
- Keypad mode
- Newline sequence
- User function keys

#### To Set the Cursor Key Mode

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the Cursor Key Mode button in the Keyboard Control section and choose the mode you want:

   - In Normal mode (the default), the cursor keys move the cursor in the specified direction.

   - In Application mode, the cursor keys generate escape sequences that the application uses for its own purpose.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Set the Keypad Mode

The keypad mode determines the behavior of keys on the numeric keypad.

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the Keypad Mode button in the Keyboard Control section and choose the mode you want:

   - In Numeric mode, when keys on the numeric keypad are pressed, the corresponding numeral is displayed in the `dtterm` window.

   - In Application mode, keys pressed on the numeric keypad generate escape sequences that the application uses for its own purpose.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Determine the Newline Sequence

The Newline Sequence option determines how carriage returns at the ends of lines are treated.

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the Newline Sequence button in the Keyboard Control section and choose the mode you want:
   - Return Only (the default) generates only a carriage return.
   - Return/Line Feed generates both a carriage return and a line feed.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Set the User Function Keys

The User Function Keys option either locks or unlocks (the default) the user function keys.

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the User Function Keys button in the Keyboard Control section and choose Locked or Unlocked (the default).

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### Screen Control

There are three aspects of screen control in a `dtterm` window:

- 132 column switching

- End-of-line wrapping

- Reverse end-of-line-wrapping

#### To Set 132 Column Switching

This option corresponds to the following `dtterm` command-line options and resource:

- `-132`
- `+132`
- `c132`

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the 132 Column Switching button in the Keyboard Control section and choose the mode you want:

   - Disabled (the default) does not change the display when an application switches to 132 columns.

   - Enabled automatically enlarges the `dtterm` window to display 132 columns when the application switches to 132 columns.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Set End-of-Line Wrapping

This option determines whether text wraps at the end of a line. It corresponds to the following `dtterm` command-line options and resource:

- `-aw`
- `+aw`
- `autoWrap`

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the End-of-Line Wrapping button in the Keyboard Control section and choose the mode you want:

   - Enabled means characters automatically wrap to the next line when the end-of-line is reached.

   - Disabled means text does not wrap.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

#### To Set Reverse End-of-Line Wrapping

This option determines the behavior of backspacing at the end of a line. It corresponds to the following `dtterm` command-line options and resource:

- `-rw`
- `+rw`
- `reverseWrap`

1. If the Terminal Options dialog box is not displayed, choose Terminal from the Options menu.

2. Click the Reverse End-of-Line Wrapping button in the Keyboard Control section and choose the mode you want:

   - Enabled means backspace characters automatically wrap to the next higher line when the end-of-line is reached.

   - Disabled (the default) means no wrapping occurs.

3. Click OK at the bottom of the Terminal Options dialog box or press Return to save your selection and exit the window.

   To save your selection and retain the window, click Apply.

## Terminal Control Characters

Because `dtterm` only emulates a terminal, your control characters might not be what you are used to on a physical terminal. The `ttyModes` resource enables you to set control characters for your terminal emulator.

By default, Login Manager sets the control characters listed in Table 12-1.

Table 12-1 Terminal Control Characters

For example, to interrupt an operation in progress, you press Control+C.

The syntax for the `ttyModes` resource is:

`ttyModes:` Control+C name

where name is the control, and C is the character. (^ is another way of expressing Control.) For example, the default value of `ttyModes` describing the preceding list is:

    ttyModes: erase ^H intr ^C kill ^U start ^Q stop ^S swtch ^@

### To Set Terminal Control Characters

1. Use the EditResources action to update the `ttyModes` resource.

2. Choose Restart Workspace Manager from the Workspace menu.

## Changing the Default Terminal Emulator

There are several other terminal emulators you can use in addition to `dtterm` . You can start most of them from an existing terminal emulator command line; however, if you want to consistently use a terminal emulator other than `dtterm` , you should change the default assignment. See the CDE Advanced User's and System Administrator's Guide for more information.

Generated with CERN WebMaker