Econlab

Running Applications in Linux

This document is intended to explain the basic commands and procedures for running statistical applications on a Linux platform. Information is tailored to the Linux environment present in SSD's Economics Laboratory, yet links are provided which reflect a more general and complete introduction to the Linux operating system, as well as each particular software application.

Getting a linux command prompt

After you have logged on to a machine in the Econ Lab, there are two ways to bring up a Linux command prompt:

  1. To run applications.
    (Instructions running Xwin32 here.)
  2. To run applications in plain text mode, click the start menu select 'SSH Secure Shell Client'. Press 'Enter' to connect and enter the host name (athensx.uchicago.edu) and your user name. (The first time you connect through SSH you will receive a message about saving the host key, just click Yes). Then enter your password at the prompt and you will see the command prompt.

Running Applications From Home

To run applications on the Athens server from home, follow the instructions on running EasyVNC.

Basic Linux commands

Here are some of the most common commands that you will need to get started running applications in a UNIX environment.

pwd print working directory. This will tell you which folder you're currently in. Upon logging in, you will be in the root of your home directory (athens/yourloginname). ls list. This will tell you which files are in the current directory. Use ls -lto show file details. cd change directory. Use cd foldernameto navigate to a subdirectory or cd ..to go up one level. mkdir make directory. Use this command to create a new folder inside the current one. cp copy. Use cp oldfile newfileto create a copy of oldfile in the current directory. rm remove. Use this command to delete files. rmdir remove directory. Use this command to delete folders. mv move. Use this command to put files in a different folder (mv file1 /temp/) or just rename them (mv file1 file2). & The &symbol is paired with another command to run that command as a background process. For example, if you want to execute an SAS program in the background you can type: sas& inputfile >outputfile
For more information on backgrounding specific applications please read our backgrounding documentation. ps This command lists the processes that you currently have running. Example "ps -ef | grep myusername" kill Use this command to end a process you have running. emacs, vi, pico These commands will open one of the three text editors available on UNIX. chmod You can use this command to edit file permissions. man manual. Use this to get help with the functions and syntax of other UNIX commands. For example: man cp. For a more complete list of UNIX commands and features, check out these sites: And for a more comprehensive introduction to UNIX, look here: There are also a few differences in the way applications run on UNIX as opposed to Windows. Here are some application specific features to take note of:

SAS

Type sasto start, and ctrl-D to exit.

To run a SAS program from the UNIX prompt, type sas filename. The SAS log file will be saved to filename.log and the output will be saved to filename.lst.

While running, all the data files created by the SAS program are stored under a temporary workspace (/tmp). After running the program, the temporary files are erased automatically, but if the running process is interrupted the temporary files will remain. If this occurs, go to /tmp to delete the working files and release the space back for public use. You may save the SAS working data file as a permanent data file if you want to use the data periodically. The simplest way to do this is to specify the storage space by assigning the library.

STATA

Type statato run in plain text mode, or xstatato run in XWindows mode. Type exitto exit.

To run a Stata program from the UNIX prompt, type:
stata -b do mydofile

Stata runs basically the same in Windows and UNIX. The only thing you'll need to get a feel for is the filesystem setup. Once you've started Stata, you can type pwdto find what directory you're in. This is your default working directory. To find where the Stata executable resides, where ado files are stored, etc., use the sysdircommand.

AMPL AND knitro

Type ampl to run in plain text mode. Type quit (or exit;) to exit.

To run an AMPL program from the UNIX prompt, type:
ampl inputfile > outputfile

To acess the KNITRO solver in AMPL, use the knitroampl command.

To acess the KNITRO solver in Matlab, first set the LD_LIBRARY_PATH environment variable with: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/knitro-ampl/knitro-8.0.0-z/lib/gcc34-sequential and then run Matlab.

To set LD_LIBRARY_PATH when you log in, create a .profile file in your home directory and add: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/knitro-ampl/knitro-8.0.0-z/lib/gcc34-sequential to your .profile

KNITRO libraries are also available for C, C++, Fortran, and Java; look in /usr/local/knitro-ampl/knitro-8.0.0-z/examples/ for details.