ARCHIVED: Getting started on Libra

Note: UITS will retire Libra in spring 2009. Accounts are available on Quarry, a general-purpose Unix computing environment. For more, see ARCHIVED: About the Libra retirement.

On this page:


Introduction

The Libra system at Indiana University was a research system consisting of an IBM cluster running AIX. Libra became available in August 2005 and was retired on June 30, 2009. Accounts are available on the general-purpose cluster Quarry.

Batch jobs are distributed among Libra's nodes by IBM's LoadLeveler batch queueing system. User home directories and shared scratch file space are accessed via NFS from the EMC NAS storage system.

Documentation and support

For announcements, documentation, graphs, and usage statistics for Libra, see the Libra system home page.

Libra is supported by the UITS High Performance Systems group. If you have questions about Libra, email High Performance Systems. If you have questions about compilers, programming, scientific/numerical libraries, or debuggers, email the High Performance Applications team. If you have questions about statistical and mathematical software, email the Stat/Math Center.

Connecting and logging in

You can access two of the Libra cluster's nodes using Secure Shell (SSH) clients: libra01 and libra02 in domain uits.iu.edu. If you have an SSH client (either the commercial client from SSH.com or the open source OpenSSH client) installed on your connecting host or workstation, establish a secure connection (password and session text information encrypted) by entering ssh hostname . For more, see ARCHIVED: Using SSH on Libra at IU.

You'll interact with AIX via the Korn, C, Bourne, bash, or tcsh shell. The Korn shell combines all the Bourne shell functions with selected C shell functions, and is the default login shell.

Once you have logged in, the Korn, Bourne, and bash shells automatically execute the /etc/profile file and your own .profile file. With the C and tcsh shells, the .login and .cshrc files are executed. You may customize your .profile, .login, and .cshrc files to suit your needs.

When you first log in, you will see the login banner, which displays current announcements. To view more detailed system news, enter news | more (to see current news) or news -a | more (to see all news).

Managing local and remote files

Like other Unix systems, AIX uses a hierarchical, tree-structured directory system to organize files. Data on local disk resides in journalled file systems that contain a root directory from which associated files and subdirectories branch. Directories are catalogs of files that associate names with files and are used to segregate files into related groups. To display information about currently mounted file systems, at the shell prompt, enter df .

Each file contains a 128-byte data segment with critical information about the file, such as file type (directory, ordinary, character special, block special, or pipe), ownership, access permissions, group ID, file size, file creation, modification, and access times, and a pointer to its data blocks. To list information about the files within your current working directory, at the shell prompt, enter ls -al . Following is a sample of ls output:

$ ls -al drwxr-xr-x 5 jdoe chem 1024 Feb 21 16:06 . drwxr-xr-x 12 bin bin 512 Feb 05 10:56 .. -rw-r--r-- 1 jdoe chem 13250 Feb 14 11:29 .Xdefaults -rw-r--r-- 1 jdoe chem 120 Dec 19 14:41 .aliases.ksh -rwxr----- 1 jdoe chem 24 Jan 13 11:50 .exrc -rw-r--r-- 1 jdoe chem 471 Jan 29 16:37 .profile -rw-r--r-- 1 jdoe chem 255 Jan 29 16:18 .rhosts drwxr-xr-x 3 jdoe chem 512 Dec 19 14:48 bin -rw------- 1 jdoe chem 2054 Feb 21 16:07 .sh_history -rw-r--r-- 1 jdoe chem 37479 Feb 21 14:51 whitepaper.pdf -rwxr-x--- 1 jdoe chem 45 Jan 16 15:22 submit.sh -rwxr-x--- 1 jdoe chem 79 Feb 19 13:02 myjob.c -rwxr-x--- 1 jdoe chem 53 Feb 19 16:45 myjob.c.old -rwxr-xr-x 1 jdoe chem 93 Jan 29 16:10 myjob.o drwxr-xr-x 2 jdoe chem 512 Dec 20 08:41 project1 drwxr-xr-x 2 jdoe chem 512 Dec 20 08:41 project2

The first character in the first field indicates the file type (e.g., - for ordinary file, d for directory). The next nine characters in the first field indicate the file access permissions: r for read, w for write, and x for execute; a hyphen (-) indicates that the corresponding read, write, or execute permission is denied. Characters 2, 3, and 4 indicate the file owner's permissions, characters 5, 6, and 7 indicate the group's permissions, and the last three characters indicate all others' permissions. Execute permission for a directory allows users to search through and list its contents.

Field 2 indicates the number of links to the file. The next two fields show the owner and the group associated with the file. Field 5 gives the size of the file in bytes. Field 6 is the time the file was created or last modified. The last field is the name of the file. The files named . and .. indicate the current and the parent directory, respectively. For more information about ls and available options, enter man ls .

To change directories, use the cd command. You can use an absolute or relative path name with the cd command. For example, assume you are currently in the /usr/local directory. To get to the /usr/local/bin directory, you could enter either cd /usr/local/bin (using the absolute path name) or cd bin (using the path name relative to /usr/local). To get back to /usr/local, you could enter cd /usr/local or just cd .. (to go up to the parent directory). Entering cd without an argument will put you into your home directory. To determine what your current working directory is, enter pwd .

Following are some common commands for working with files:

  • To view a file on your screen, enter cat . To view one screen at a time, enter cat | more .

  • To copy a file to the same or a different directory, enter cp . This command overwrites any existing file of the same name. For more information, enter man cp .

  • To rename a file or to move it to a new directory, enter mv . For more information, enter man mv .

  • To delete a file, enter rm . For more information about deleting single or multiple files, enter man rm .

  • To create a directory, use the mkdir command. To delete an empty directory, use the rmdir command. For more information, enter man mkdir or man rmdir .

You can also use the commands for managing local files to manage remote NFS files, provided that the access permissions allow it. For example, you cannot use rm on a file in a remote file system that's mounted as read-only.

For access to remote files other than those already accessible to Libra, you may access a remote host using the Secure Shell scp or sftp commands to copy files to or from the remote system.

To see how many 1KB blocks of disk space you are using, enter du -k . To see the number of 1KB blocks in your disk quota, enter nfsquota .

You may exceed your soft quota up to the limit of your hard quota. If you exceed your soft quota, you will receive a message to that effect. You then have seven days to reduce your use below your soft quota. If you do not reduce your disk usage below your soft quota, at the end of the grace period you will not be able to write to your disk until you reduce your disk usage below your soft quota. The grace period is seven days.

Using the vi editor

Before you use vi

Before entering vi, make sure your environment variable TERM is set correctly. When vi starts, it looks at TERM to see what kind of terminal you are using. It will then load the proper terminal control information from /etc/termcap (the terminal capabilities file). Enter the appropriate commands below depending on your shell:

  • If you use the Bourne (sh) or Korn (ksh) shell: $ TERM=vt100 $ export TERM $ vi filename
  • If you use the C shell (csh): % setenv TERM vt100 % vi filename

Important commands

The most important commands are:

u (lowercase) Undoes the previous command
U (uppercase) Undoes all changes to the current line
Ctrl-l (a lowercase letter L) Clears and redraws the screen
:q! Exits vi without saving the changes
:ZZ Exits vi and saves the changes

Scrolling and moving the cursor

Ctrl-u Scroll Up one half screen
Ctrl-d Scroll Down one half screen
Ctrl-f Scroll Forward one full screen
Ctrl-b Scroll Backward one full screen
b Move to beginning of previous word
e Move to end of next word
w Move to next word
( Move backward to beginning of sentence
) Move forward to beginning of sentence
{ Move to beginning of paragraph
} Move to end of paragraph
$ Move to first nonspace character on line
h Move cursor to left
j Move cursor down to next line
k Move cursor up to previous line
l Move cursor to the right

Input mode

The Esc key terminates input mode and returns you to command mode. The following commands will put you in input mode:

a Append text after the cursor.
i Insert text in front of cursor.
o Open a new line below the current line.
s Substitute character
A Append text at the end of the line.
I Insert text at the beginning of the line.
O Open a new line above the current line.
R Replace text beginning at the cursor.
S Substitute entire line

Deleting text

Deleted text is placed in the undo buffer. If you make a mistake when deleting text, you can undo the deletion by typing  u  to undo the last delete or  U  (Shift-u) to undo all changes made to the current line. You can also insert the deleted text in another part of the file by using the  p  or  P  (Shift-p) command. See the Yank section below.

X Delete character to left of cursor
x Delete character under the cursor
dd Delete entire line
dw Delete word
d( Delete to beginning of sentence
d) Delete to end of sentence
d^ Delete to beginning of line
d$ Delete to end of line
D Delete to end of line

Following are examples:

5dd Delete the next 5 lines.
10X Delete 10 characters to the left of the cursor.
3dw Delete the next 3 words.

Yanking text

Yanking copies text from the file into the undo buffer. You can then insert the yanked text into another part of the file by using  p  (to insert the contents of the undo buffer after or below the cursor) or  P  (Shift-p) (to insert the contents of the undo buffer before or above the cursor).

yy Yank entire line
yw Yank word
y( Yank to beginning of sentence
y) Yank to end of sentence
y^ Yank to beginning of line
y$ Yank to end of line
Y Yank to end of line

Following are some examples:

5yy Yank the next five lines.
3yw Yank the next three words.

Changing text

Use the change commands to modify existing text in a file. After you type the change command, vi will mark the end of the selected region of text with a dollar sign ($) and go into input mode. After you have finished typing the text, press Esc to exit input mode.

cc Change entire line
cw Change word
c( Change to beginning of sentence
c) Change to end of sentence
c^ Change to beginning of line
c$ Change to end of line
C Change to end of line
r Replace the character under the cursor.
R Replace the text starting at the cursor.

Following are some examples:

5cc Change the next five lines.
3cw Change the next three words.

Character string searching

/ Search forward in file for string
? Search backward in file for string
n Locate next occurrence of string
N Locate next occurrence in opposite direction

Following are a few of the special characters used in search strings:

^ Match string starting at beginning of line
$ Match string starting at end of line
. Match any character

Following are some examples:

/text/ Searches forward for text
?text? Searches backward for text
/^buddy/ Searches forward for buddy at beginning of line
/csh$/ Searches forward for csh at end of line

Miscellaneous commands

:r This command allows you to read a file into the one that you are editing. Place the cursor on the line above where you want to read the file in and enter :r filename .
:r!unixcommand This will execute the specified Unix command and insert the command's output into the edit file after the current line.
Ctrl-g This command will display a status line at the bottom of the screen to show you where you are in the file.

For more about using vi, search the IU Knowledge Base. You can also find more information in Learning the vi Editor by Linda Lamb (O'Reilly and Associates, Inc., 1992), $21.95.

Using the GNU Emacs editor

GNU Emacs is a new version of Emacs written by the author of the original (PDP-10) Emacs, Richard Stallman. GNU Emacs retains all the functionality of other Emacs editors, but it is also customizable and extensible by modifying its Lisp editing commands. GNU Emacs is designed to work well with X Window systems, but it also functions with ASCII terminals.

Before using GNU Emacs, set up an initialization file to allow Emacs to work correctly with your terminal type. If you use an ASCII terminal, use the vt100.emacs file in /usr/local. If you use X Window, use the aixterm.emacs in /usr/local. Copy the appropriate file to your home directory, naming it .emacs, as in the following example: cp /usr/local/vt100.emacs $HOME/.emacs

Because GNU Emacs uses the Ctrl-q and Ctrl-s key sequences as commands, disable the use of Ctrl-q and Ctrl-s as terminal output start/stop signals before entering GNU Emacs. To do this, enter stty -ixon . After completing your GNU Emacs session, you may re-enable terminal start/stop signals by entering stty ixon .

GNU Emacs has an extensive interactive help facility, but to use it you must know how to manipulate Emacs windows and buffers. To enter the help, press Ctrl-h . To access an interactive tutorial that teaches the fundamentals of Emacs, press Ctrl-h t . To find a command given its functionality, press Ctrl-h a . The Help Character command (Ctrl-h c) describes a given character's effect, and the Help Function command (Ctrl-h f) describes a given Lisp function specified by name.

For information about common Emacs commands, see GNU Emacs Quick Reference Guide.

Command files (shell scripts)

Shell scripts are command files interpreted by a shell. These scripts may contain any statements valid in the shell in which they are interpreted. You can use them to perform repetitive tasks, such as setting up your environment, compiling and executing programs, submitting batch jobs, and performing system management tasks. Much of AIX's System Management Interface Tool (SMIT) is written in Korn shell scripts. Locally written shell script utilities are contained in /usr/local/bin.

Shell programming constructs include variable assignment, argument handling, evaluation of integer expressions, conditional execution, flow control, file status checking, string and integer comparisons, reading of input, interrupt signal traps, and menu screen generation.

The following examples, one for the Korn Shell and a similar script for the C shell, illustrate some basic shell programming constructs.

Korn shell script

# Scriptname: showuser # Purpose: displays information about a specified user USAGE="Usage: showuser userid" # Test for argument if [ "$#" -gt 1 ] then echo $USAGE exit 1 fi if [ "$#" -eq 1 ] then USERNAME=$1 elif [ "$#" -eq 0 ] then echo "Enter the user's login name: \c" read USERNAME JUNK fi IFS=":" # internal field separator # Use sed to edit /etc/passwd, putting blank in empty field sed "s/$IFS$IFS/$IFS $IFS/g" < /etc/passwd | \ # Pipe the line to the read command while read LOG PW UID GID GDATA HDIR LSH do if [ $LOG != $USERNAME ] then continue fi if test -z "$LSH" # if string has zero length then LSH="/bin/sh" # then display the default shell fi # Display the entry for the user cat << END ________________________________________ Userid : $LOG UID : $UID GID : $GID Full Name : $GDATA Home Directory : $HDIR Login Shell : $LSH ________________________________________ END done exit

C shell script

# Scriptname: showuser # Purpose: display information about a user set USAGE = "Usage: showuser userid" # Test for argument if ($#argv > 1) then echo $USAGE exit 1 endif if ($#argv == 1) then set USERNAME = $1 else if ($#argv == 0) then echo "Enter the user's login name: " set USERNAME = $< endif set IFS = ":" # internal field separator # Use sed to edit /etc/passwd, putting blank in empty field sed "s/$IFS/ /g" < /etc/passwd > $HOME/passwd echo "_________________________________________________________" echo "Userid UID GID Full Name Home Directory Login Shell" echo " " # Use awk to find the correct line and print it out awk "/$USERNAME/" $HOME/passwd echo "_________________________________________________________" rm $HOME/passwd exit

Submitting batch jobs to LoadLeveler

To optimize job throughput, efficiency, and performance on Libra, you must submit all CPU-intensive jobs (i.e., jobs requiring more than 20 minutes of CPU time) as batch jobs to the LoadLeveler batch scheduler. For information, see ARCHIVED: Using LoadLeveler on Libra at IU.