Unix is the operating system running on all Linux workstations, but it's often overlooked that it's the underlying operating system for Apple's OSX as well. It is by far the most widely used for computational crystallography platforms.

Unix has a number of useful features:

The latter feature is especially useful because it's the habit of other applications overwriting operating system memory that makes older PCs and Macs crash with monotonous regularity. Unix systems are still inherently more stable. PC hardware running Linux or a Mac running OSX crashes about once every 3-4 months, at most. A PC running Windows crashes considerably more often (more recent versions of Windows tend to be better).

Other sources of beginner Unix guides and references are:

And you can find a lot more via Google.

The Unix Filesystem

Unix maintains the usual tree-like architecture of files and directories contained within directories. The whole thing starts at the "root directory", called /. Parts of the directory tree are separated by the / character. Any file spec (path) starting with / is called the absolute path to the file in the sense that it's an unambiguous location of a file:
/usr/people/phil
means that "phil" lies within the directory called "people", "people" is in "usr" and "usr" is a subdirectory of the root directory. In contrast a relative path doesn't start with / and is interpreted in the context of your current directory. With:
% cd /usr
% ls people/phil
% ls /usr/people/phil
should produce the same results for both ls commands.

From the user perspective the file system contains just files and directories. More specialized file types exist, however, in use by the operating system. A more advanced user might use links (either hard links or soft links) to create aliases to a file that is located elsewhere but everything you're going to need to achieve using Unix can be handled without aliases, and disk space is very cheap these days.

A very advanced discussion of the file system can be read here

Basic File Manipulation Commands

Command Description Usage example
cd Change directory cd subdir
pwd Print working/current directory pwd
mkdir Make directory mkdir subdir
rmdir Remove (delete) directory rmdir subdir
ls List directory contents ls *.img
cp Copy (duplicate) file cp a.pdb b.pdb
rm Delete file (permanently!) rm a.pdb
mv Move (rename) file mv a.pdb b.pdb
cat Concatenate (list) file to screen cat a.pdb
more Page through a file more a.pdb
head Show top of file head a.pdb
tail Show end of file tail a.pdb
grep Search for string in file grep "HIS" a.pdb
file Try and determine type of file file /bin/ls

Home directory is the top of your personal file tree. Abbrevations for home are "~" for your home and "~user" for the home directory of "user". The directory "." is always the current directory. The directory ".." is the parent directory. Directories in a filename are separated with the forward slash "/" in Unix (":" in pre-OSX Macs, "\" in Windows/DOS) e.g. ~phil is synonymous with /usr/people/phil on a Linux box. There is no Trash in Unix, although Linux and OSX window managers implement one. Once you delete a file with rm it is gone forever.

Simple Shell Commands

alias Make command alias alias ls 'ls -alF'
echo Echo string to output echo "This data is bad"
exit Exit the shell exit
history Show command history history
logout Exit the (login) shell logout
set Set variable to value set a = 1
setenv Set environment variable to value setenv DISPLAY ximpact1:0

See ~phil/.cshrc for examples of this usage, and other stuff. Also see Unix Shell Scripting for an intro into C shell scripting.

More Simple Unix Commands

date Show date and time date
df Display filesystem data df -k
du Disk usage du -sk *
man Manual (help) man cat
script Record EVERYTHING you type/see script really_big_logfile
who Who is logged into the system who
whoami Who the Hell am I ? whoami
which Which command will I execute? which denzo

Job Control

& Run process in background gzip *img &
^Z Suspend (stop) process ^Z
^C Interrupt (kill) process ^C
bg Run (suspended) process in background bg
fg Run process in foreground fg
ps Show processes ps, ps -efl
jobs Show jobs (process under shell control) jobs
kill Kill process kill process_id
killall Kill all named processes killall mozilla
nice Run processes at reduced priority nice gzip *img

If a process is running in the foreground, the shell waits for it to complete before accepting more command input. In the background, the process runs semi-independently of the shell - even if the shell exits the process keeps running (you may need "set nohup" in your .cshrc for this).

File Redirection

C shell. Bourne (again) shell uses a slightly different syntax for more complicated redirections.

> Write output to file ls > listing
>> Append output to file ls .. >> listing
| Piple output to input of next command ls * | grep img
< Take input from file molscript < ms.in
<< String Read data from input until "String" peek2 << EOF

If you have noclobber set in tcsh, then > and >> will not overwrite existing files or create new ones. Use the forms >! and >>! to override this option.

Advanced File Manipulation

chown Change owner chown phil.user myfile.dat
chmod Change mode (permissions) chmod a+x my_script_file.csh
ln Soft or hard links ln -s ../mbsd39.fobs my_local_clone.fobs
cut Cut file by columns cut -c1-30 file1
paste Paste files back together by columns paste file1 file2
diff Show file differences diff peek2.f peek2_old.f
sort Sort a file sort -n +7 -8 water.pdb
tee Copy output to screen and file simultaneously ./phaser.com | tee phaser.log
touch Create empty file/update access time touch file1
wc Count characters/words/lines wc file1
find Powerful file finder find . -size +3000 -print

Use of any of these commands without consulting the manual first (e.g. "man find") is likely to result in disaster.

File Transfer and Archiving

Best current technology uses: bzip2 or gzip for compression; sftp, scp and ssh for secure file transfer/copy and login. Ftp, telnet and compress are older technologies.

bzip2 Slower, very efficient file compresson bzip2 *.img; bunzip2 *img.bz2
gzip Fast, efficient file compression gzip *.img ; gunzip *.img.gz
compress Less efficient file compression compress *.img ; uncompress *.img.Z
tar Make tape/disk archive tar -cvf /dev/tape my_data/.
ftp File transfer between remote machines ftp xray2.princeton.edu
scp Secure file copy (between machines) scp my_file user@xray2.princeton.edu:Desktop/.
sftp Secure file transfer sftp xray2.princeton.edu
ssh Secure login to remote machine ssh user@xray2.princeton.edu
telnet Login to remote machine telnet xray2.princeton.edu

Simple Graphics Commands - LINUX

Most of the graphics features of Linux are via ImageMagick or the Gnu Image Manipulation tool. You can obviously invoke the names of graphics programs like Coot or Pymol from the command line if you have those programs set up correctly.

display Display graphics file display image.jpg
convert Convert between file formats convert image.jpg image.pict
gimp Photoshop-like image manipulation gimp

Simple Graphics Commands - SGI - does anyone still have SGIs ?

acroread Adobe Acrobat Reader (PDF) acroread paper.pdf
xpsview View Postscript files xpsview paper.ps
display Display graphics file display image.jpg
xv Display graphics file xv image.jpg
ipaste Display graphics file (SGI format only) ipaste image.sgi
convert Convert between file formats convert image.jpg image.pict
imgworks SGI-format image manipulation imgworks image.sgi
cedit Interactive color editor cedit
makemap Restore colormap after cedit mangling makemap