next_inactive up previous


Introduction to unix/linux

Rafael A. Irizarry

Files

Directories

Permissions

Executables

All programs that run on unix are executable files. Many are binary so you can't see them. For example try looking at ls less /bin/ls. However other executables you can see, less ~ririzarr/bin/mydvipdf.

You can easily make a program and run it. For example use this simple script to install a local version of R:

After downloading the source create a file called installR-1.9.1 with the following content:

tar -xvzf R-1.9.1.tgz
cd R-1.9.1
./configure --prefix=/home/bst/faculty/ririzarr/R-1.9.1
make
make install

I run this by typing ./installR-1.9.1 in my \~ririzarr/src directory. Here is an example of a command that will run R in batch mode:

/bin/nice -19 R --no-save BATCH $1.R -o a.out &

You can also use

/bin/nice -19 R --no-save < $1.R \&> a.out &

Important: The & at the end runs this job on the background. It is useful to learn the commands: fg, bg, kill, top to manipulate what is running in the background and foreground. It is also important to learn about standard output and standard error. The & and > in front of a.out says ``send error messages and output to the file a.out''. & is std error and > is for output. The default is to screen.

Important: The nice in front of a command says to unix to let other jobs have priority over this one. This is important because the people using the system interactively should not be affected by a job that you are willing to wait hours for. In tsch you type

nice +19
. You can also renice using top

The shell

The shell is a program that runs on pretty much all unix/linux machines by default. It is hard to distinguish between what is unix and what is the shell, and you don't necessarily need to know the difference. All shells are similar and the important stuff is in all of them. But, you need to be aware that there are different shells.

My favorite is bash. Currently, this is not the default on athena. So if you want bash you need to ask Jiong to change it.

Wild cards

All shells use the same wild cards.

For example, [a-z]* matches all names in the current directory beginning with one of the letters a through z.

the rc file

You can define your own commands and change options for you shell using the .bashrc file.

To define ``new commands'' use the aliases. See ~kbroman/.bashrc for an example.

Creating your own bin

If you type ls on your prompt, the shell knows it's a command so it needs to find the file to run it. There are many predefined places but the pwd is not one them. If you want to run an executable on your pwd you need to type ./filename.

However you can change the places to look by changing your PATH environment. We recommend having a directory called bin in you home dir where you store executables you create (for example your own copy of R). To change the path in tcsh you can use:

setenv PATH
/users/faculty/ririzarr/bin:/usr/dt/bin:/usr/local/bin:/bin
:/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin:/usr/openwin/bin:/usr/local/teTeX/bin/sp
arc-sun-solaris2.8:/usr/local/office52/program:/usr/local/vni/bin:/usr/local/xg
obi/src:/usr/local/SUNWspro/bin:/usr/ucb:/opt/SUNWdtpcv/bin:/export/home/mtaylo
r/postgresql/bin

PATH=/users/faculty/ririzarr/bin:/usr/dt/bin:/usr/local/bin:/bin
:/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin:/usr/openwin/bin:/usr/local/teTeX/bin/sp
arc-sun-solaris2.8:/usr/local/office52/program:/usr/local/vni/bin:/usr/local/xg
obi/src:/usr/local/SUNWspro/bin:/usr/ucb:/opt/SUNWdtpcv/bin:/export/home/mtaylo
r/postgresql/bin

Once you do this your unix will look for programs in your bin directory.

Useful commands

See this page

For others see: http://www.biostat.jhsph.edu/~kbroman/unix_tools/

Remote login

You can login to enigma (and from enigma to other machines) from outside Hopkins using ssh.

MacOS X and Linux come with ssh and X windows so you can open X windows from home without any effort. With a fast connection it will seem as if you were at work.

For Microsoft windows you need to download and install ssh (there are two openSSH and commerical ssh, both free). If you want X capabilites you need another program. cygwin comes with a free version of X for msft windows. There are other products that are nicer but cost money.

Web pages

Notice you all have the ability of creating having a web page under http://www.biostat.jhsph.edu/~loginname. All you need to do is logon to www.biostat.jhsph.edu and create an index.html file in the directory public_html

About this document ...

Introduction to unix/linux

This document was generated using the LaTeX2HTML translator Version 2002 (1.62)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 unix.tex

The translation was initiated by Rafael A. Irizarry on 2004-09-02


next_inactive up previous
Rafael A. Irizarry 2004-09-02