NCBI
Home
Up

UNIX Basics

UNIX is an operating system that is used on many mainframe computers.   It was developed to aid timesharing, filesharing, and some other functions of large computers.  It is a flexible and powerful operating system, but is not familiar to the bulk of PC users, although many UNIX functions have obvious PC or Mac homologs.   UNIX as we use it will be a command-line operating system driven by typed commands, not a "clickable", "drag-and-drop" system.  I will describe most UNIX commands by analogy to DOS commands, which may be helpful to some users.

File and Directory Structure

UNIX uses a tree-like directory structure that is familiar to most computer users.  Your account is essentially a subdirectory within the entire mainframe.  This account directory (eg. home/staben) contains files that specifies certain defaults to the mainframe as well as my personal directories and files.   Directories may contain other subdirectories and/or individual files.

UNIX uses paths to describe the routes to directories.  For example, /home/staben/gcg/ is the path to a specific subdirectory.   Paths can be explicit or may assume certain conventions.  Please note that UNIX uses the "forward slash" / in directory paths.

Navigating and listing the contents of directories is a critical skill in which you must understand the following commands:

  • pwd (print working directory):  tells you in which directory you are currently active.  Your prompt may do this.

  • ls (list) lists all files and directories within the current directory (except certain hidden files, like .login and .cshrc)

  • cd newdir (change directory)  change to the new directory.

  • cd .. changes to one level higher directory

  • mkdir newdir which creates a new directory

  • rmdir olddir which will remove empty directories

Manipulating Files

The basics are copying, deleting, and viewing files. 

PLEASE NOTE that you should  keep filenames simple and DO NOT use certain reserved characters (like spaces, /,"...).  Stick to the letters and numbers.  Actually, DOS conventions like filenam1.ext will work well.

  • more filename prints the given file to your monitor one screen at a time.  ctrl-c interrupts this!

  • cp filename1 filename2 copies the current filename1 into the existing or new filename2

  • rm filename1 deletes the file.  Beware!

Wildcards are a useful, powerful, and dangerours shorthand for manipulating files.
* (star) is the most useful wildcard, it stands for "any number of any characters".  One can use this in expressions, like, rm *.*, which will delete almost all files in your directory.

File Editing

File editing is certainly possible, but somewhat unfriendly, on UNIX.  It is easiest to avoid editing on UNIX for the naive.  To do so, TRANSFER your files from the mainframe, edit them with your favorite text editor (SimpleText, Notepad, Word, Wordperfect...), SAVE them as TEXT, then upload them.

One of the common, older, editors is vi This visual editor is actually the backbone of many GCG programs like Seqed and GelAssemble.   Those of you who know vi may use this to advantage.

University of KentuckyMorgan School of Biological SciencesNSF-CCD Support wpe1.jpg (5798 bytes)Chuck Staben, copyright reserved || 09/21/98