Appendix A. Using IRIX Commands
Prev |  | Next

## Appendix A. Using IRIX Commands

The Indigo Magic User Environment allows you to work with the IRIX operating system by pointing at and clicking on icons. You can also use the traditional interface to IRIX — the shell.

This Appendix explains how to start and stop IRIX shells and teaches you how to use some basic IRIX commands. It contains these sections:

- “Opening a Shell Window”

- “Using IRIX Commands: A Few Basics”

- “A Quick Reference to IRIX Commands”

- “A Quick Reference to IRIX Shortcuts”

- “Determining Your Current Working Directory”

- “Moving to a Different Directory Using the cd Command”

- “Viewing the Contents of a Directory Using the ls Command”

- “Creating Directories Using the mkdir Command”

- “Viewing the Contents of a Directory Using the dirview Command”

- “Copying a File or Directory Using the cp Command”

- “Accessing an Icon from Several Different Directories Using the ln Command”

- “Renaming and Moving Files Using the mv Command”

- “Deleting Files Using the rm Command”

- “Deleting Directories Using the rm and rmdir Commands”

- “Printing Using IRIX Commands”

- “Setting Permissions Using the chmod Command”

- “Getting Reference Information on IRIX Commands”

## Opening a Shell Window

The shell is the traditional interface to UNIX workstations. It is a window in which you type IRIX commands, and it is identical in structure to other windows. You can start additional shells by following these steps:

1. Choose “Unix Shell” from the Desktop toolchest.

   A red outline of a window appears.

2. Move the mouse until the outline is positioned where you want it; then click the left mouse button.

   The shell window appears. Its fixtures look like those on other windows, but inside the body is a prompt (often a # or % sign) and a square cursor. See Figure A-1 .

   Figure A-1. A shell window.

3. Move the cursor inside the window.

   Notice that the title bar highlights and the small green rectangle becomes solid. This indicates that the window is active; you can begin typing commands.

You close a shell window just as you close any other window. See “Closing Windows” for instructions.

## Using IRIX Commands: A Few Basics

This section provides information on pathnames and background processes.

### Understanding Pathnames

There are two types of pathnames: absolute pathnames and relative pathnames. An absolute pathname provides complete directions to a location in the IRIX file system, starting from the topmost directory.`/usr/people/joe/reports` and `/usr/people/joe/Budgets/budget92` are examples of absolute pathnames.

A relative pathname is based on the directory in which you are currently working. For example, if you are in`/usr/people/joe` and want to open a file named `reports`, you type:`jot reports`. If you want to open a file in a subdirectory called `Budgets`, you type:

`jot Budgets/`filename

### Using Background Processes

When you use IRIX commands to run an application, you can end the command line with the ampersand sign (&). This runs the application in the background so you can type other commands in the shell window and minimize the shell without quitting from the application.

Certain commands probably should not be run as background processes — the vi text editor for example. vi lets you create or edit a text file within the shell window. If you type `vi &`, vi runs the but the text never appears in the shell window; you can't read or edit the text.

## A Quick Reference to IRIX Commands

Table A-1 lists the IRIX commands discussed in this chapter and provides a quick summary and example for each.

Table A-1. Summary of IRIX commands.

Command | Use | Example
--- | --- | ---
`pwd` | To determine your current working directory. | `pwd` This displays the name of the directory in which you're working.
`cd` | To change (move) to a different directory. | `cd /usr/tmp` This moves you to the `/usr/tmp` directory.
`ls` | To list the contents of a directory. | `ls /usr/tmp` This lists the contents of the `/usr/tmp` directory.
`dirview` | To open a Directory View window that displays the contents of a directory. | `dirview /usr/tmp` This opens a Directory View window for the `/usr/tmp` directory.
`mkdir` | To create new directories. | `mkdir reports` This creates a `reports` directory in your current working directory.
`cp` | To copy a file or directory. | `cp oldfile oldfile.copy` This creates a copy of `oldfile` and names it oldfile.copy.
`ln` | To create a linked copy of a file. This lets you access one file from several different places. | `ln images movies/images` This lets you access the file `images` from a directory called movies.
`mv` | To move and rename files and directories. | `mv oldfilename newfilename`This renames `oldfilename`.
`rm` | To delete files. | `rm oldfile` This deletes `oldfile`.
`rm -r` | To delete all the files in a directory before deleting the directory itself. | `rm -r /usr/people/joe/reports` This deletes all of the files in the `reports` directory; then deletes the `reports` directory.
`rmdir` | To delete empty directories. | `rmdir /usr/people/joe/reports` This deletes the `reports` directory.
`lp` | To print files. | `lp images` This prints the file `images`.
`lpstat` | To check the print queue. | `lpstat -s` This provides a summary of your print requests.
`chmod` | To change permission settings for a file. | `chmod go-wx images` This takes away write and execute permissions for Group and Other.
`man` | To open the man page for an IRIX command. | `man lp` This opens the man page for the `lp` command.
`man -t` | This lets you print the specified man page. | `man -t lp` This prints the man page for `lp` on your default printer.

## A Quick Reference to IRIX Shortcuts

Certain special characters act as shortcuts.Table A-2 contains a list of these characters and an explanation of their use.

Table A-2. IRIX shortcuts.

Character | Use | Example
--- | --- | ---
* (wildcard) | A substitute for any number of characters. | `ls *.doc` This lists all files in the current directory ending in .doc.
? | A substitute for one character. | `ls ch?.doc` This lists all files in the current directory that begin with `ch` followed by one other character, and end with `.doc`. For example, `ch1.doc`, `ch2.doc`, and so on.
. | An abbreviation for the current working directory | `dirview .` This opens a Directory View window for your current directory.
.. | An abbreviation for the parent directory | `cd ..` This moves you up one directory.
~ | An abbreviation for your home directory | `cd ~/reports` This moves you to the `reports` directory in your home directory.
!! | A command to repeat the last command you typed. |
^ | A symbol for replacing characters. | `cp ch1.doc /usr/tmp ^1^2` This reissues the command using `ch2.doc`.

## Determining Your Current Working Directory

The title bar of a Directory View windows lists the name of the directory whose contents it displays. When you are typing commands in a shell window, you use the `pwd` command to find out the name of the directory in which you are located. `pwd` stands for print working directory, or loosely translated, “Where am I?”

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. At the prompt, type:

       pwd

   Then press `<Enter>`.

The IRIS responds with a pathname.

## Moving to a Different Directory Using the `cd` Command

`cd` is the IRIX command for changing from one directory to another. To use it:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type `cd`, followed by the name of the directory to which you want to switch. For example, to switch to a directory named`/usr/tmp`, type:

       cd /usr/tmp

   Then press `<Enter>`.

| Tip: Two periods (..) is an abbreviation for the name of the parent directory. In other words, it says to go up one directory. Suppose you are working in `/usr/people/joe/Reports` and want to move to `/usr/people/joe/Images`. You can type: `cd ../Images` `cd` alone takes you to your home directory.

## Viewing the Contents of a Directory Using the `ls` Command

`ls` is the IRIX command for opening and displaying the contents of a directory. To use the `ls` command:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Use the `cd` command to move to the directory whose contents you want to view. For example, type:

       cd /usr/people/<loginname>

   Then press `<Enter>`.

3. Type:

       ls

   Then press `<Enter>`.

   The contents of your home directory appear as a list.

IRIX can give you a more informative listing when you use an option with the `ls` command.

- The a option lists all of the files, even those that begin with a period (.)

- The F option with `ls`:

  - puts an asterisk (*) next to all programs

  - puts a trailing slash (/) after all directories

  - does not add any characters to plain text files

## Viewing the Contents of a Directory Using the `dirview` Command

`dirview` is the IRIX command to open a Directory View window. Directory View windows display the contents of a directory graphically. To use the `dirview` command:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type `dirview`, followed by the name of the directory whose contents you want to display in a Directory View window. For example, to open a Directory View window for `/usr/sbin`, type:

       dirview /usr/sbin

| Tip: To open a Directory View window for the directory you are currently working in, type: `dirview .` A period (.) is an abbreviation for the name of your current working directory.

## Creating Directories Using the `mkdir` Command

`mkdir` is the IRIX command for making a new directory. This example shows how to make a new directory called `sub` in your home directory.

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Use the `cd` command to move to the directory in which you want to create a new directory. For example, type:

       cd /usr/people/<loginname>

   Then press `<Enter>`.

3. Type:

       mkdir sub

   Then press `<Enter>`.

   This command creates a directory called `sub` in your home directory.

   See “Creating a Directory” to learn how to create new directories using the graphical interface.

## Copying a File or Directory Using the `cp` Command

`cp` is the IRIX command for copying files and directories. This example shows how to to copy a file called `oldfile`.

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       cp oldfile oldfile.copy

   Then press `<Enter>`.

This command means “copy `oldfile` from my current working directory into a file named `oldfile.copy` in my current working directory.” To place the copy in a different directory, add a pathname before the new file name.

See “Copying Icons” to learn how to copy files using the graphical interface.

## Accessing an Icon from Several Different Directories Using the `ln` Command

`ln` is the IRIX command for creating linked copies. A linked copy lets you create different names for one file. Suppose you have a file named `images` in `/usr/people/joe`. You work in `/usr/people/joe/movies` quite frequently and want to easily access the `images` file.

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Use the `cd` command to move to the`/usr/people/joe` directory. Type:

       cd /usr/people/joe

3. Then type:

       ln -s images movies/images

   | Note: You could also give the file a different name.

See “Making a Linked Copy” to learn how to make linked copies using the “Make Linked Copy” command.

## Renaming and Moving Files Using the `mv` Command

`mv` is the IRIX command for renaming and moving files and directories.

To rename a file using the `mv` command:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       mv oldfilename newfilename

   `oldfilename` is now named `newfilename`.

   | Note: Do not use blank spaces when renaming files using IRIX commands. IRIX does not replace blank spaces with underscores, so you'll have problems accessing the file later.

To move `oldfile` from `/usr/people/joe` to `/usr/tmp`:

1. Place the cursor in the shell window.

2. Type:

       mv oldfilename /usr/tmp/oldfilename

See “Renaming Files and Directories” to learn how to rename files using the graphical interface; see “Moving Icons” to learn how to move files using the graphical interface.

## Deleting Files Using the `rm` Command

`rm` is the IRIX command for deleting files. You type `rm` followed by the name of the file you want to delete. For example, to delete a file named `oldfile`:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       rm oldfile

   This deletes the file named `oldfile` in your current working directory.

See “Removing Files” to learn how to delete files using the “Remove” command.

## Deleting Directories Using the `rm` and `rmdir` Commands

`rmdir` is the IRIX command for deleting an empty directory; an option to the `rm` command lets you delete a directory and all of the files it contains.

To delete an empty directory:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Use the `cd` command to move to the directory that contains the empty directory you want to delete. For example, if you want to delete a directory named `oldfiles` in`/usr/people/joe`, type:

       cd /usr/people/joe

   Then press `<Enter>`.

3. Type:

       rmdir oldfiles

   Then press `<Enter>`.

   The `oldfiles` directory is deleted.

To delete a directory and all of the files it contains:

1. Use the `cd` command to move to the directory that contains the directory you want to delete. For example, if you want to delete a directory named `oldfiles` in`/usr/people/joe`, type:

       cd /usr/people/joe

   Then press `<Enter>`.

2. Type:

       rm -r oldfiles

   Then press `<Enter>`.

   This deletes all of the files in the directory then deletes the `oldfiles` directory itself.

## Printing Using IRIX Commands

You can easily print from your IRIS workstation using the graphical tools and menu commands. This section describes an alternative — printing using the`lp` command and checking the status of a print request using the `lpstat` command.

### Printing Using the `lp` Command

`lp` is the IRIX command for printing a file. You type `lp` followed by the name of the file you want to print. The file prints on your default printer. For example, to print a file named `images`:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       lp images

   Then press `<Enter>`.

To print to a printer other than the default, you can use the `-d` option to`lp`. For example, to print `images` to a printer named printer2, you would type:

    lp -dprinter2 images

See the Personal System Administration Guide for instructions on installing the printer. See the `lp` man page for a list of all the available options and capabilities.

### Checking the Print Queue Using the `lpstat` Command

`lpstat` is the IRIX command for displaying the list of print requests that have been sent to a printer. The `-s` option provides a summary of your print requests.

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       lpstat -s

   Then press `<Enter>`.

See “Viewing the Queue of Print Jobs” to learn how to use the Print Manager to check the status of your print requests. See the `lpstat` man page for a list of all the available options and capabilities.

## Setting Permissions Using the `chmod` Command

`chmod` is the IRIX command you use to change permission settings for a file. You can specify Read (r), Write (w), and Execute (x) permissions for the file's owner (u), the group (g), and others (o).

You type `chmod` followed by the permission setting information followed by the file name whose settings you are changing. The permission setting information has several parts. You specify:

- who is affected by the change (u, g, o)

- whether you are adding or taking away permissions

- and which permissions are affected (r, w, x)

For example, suppose you have a file named `images` that everyone can read, write, and execute. You decide you want to prevent all others from writing and executing the file.

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       chmod go-wx images

   Then press `<Enter>`.

See “Understanding Permissions” and “Changing Permissions” for instructions on using a menu command and form to change permission settings.

## Getting Reference Information on IRIX Commands

By default, your IRIS workstation contains online man pages that have information on all IRIX commands. For example, to access a man page for the `ls` command:

1. Place the cursor in the shell window.

   To open a shell window, choose “Shell” from the Tools toolchest. See “Opening a Shell Window” for step-by-step instructions.

2. Type:

       man ls

   Then press `<Enter>`.

   After a few moments the man page is displayed.

| Note: The `-t` option lets you print a man page. For example, to print the man page for the `lp` command, you type: `man -t lp`

Prev | Table of Contents | Next
Chapter 11. Reference |  | Glossary