UNIX Basics
A. Miyoshi

UNIX Basics

Here, basic knowledge of UNIX is briefly summarized.  This is not intended to be used for learning UNIX.  For this purpose, consult an appropriate textbook or information on web pages.

Basic Concepts

At least, understand the followins.

Directory

Coresponding to "Folder" on Windows.  The directory currently in operation is called "Current Directory", and a file name specified without its location is assumed to be present in the current directory.

Jobs

The works done by a computer is called "jobs".  When you type a command such as ls and cp, it is executed as a foreground job.  Until the job is completed, a prompt will not appear and thus the next commend cannot be issued.  Since a numerical calculation job, such as a Gaussian job, takes some time for completion, and is usually executed as a background job, by typing "&" at the end of the command.

Handling Files and Directories

Major file and directory handling commands and their frequently used options are summarized below.  Before issuing a command, check and understand the details of the options such as -f, -r, and -R by using man command etc.

Commands

frequently used options
ls Display files and/or directories -l, -a
cp Copy a file or a directory -R
mv Move a file or a directory
rm Remove a file (or a directory) -r, -f
mkdir Create a directory
rmdir Remove a directory
cd Change the current directory
pwd Print the current directory

Oprions

-r, -R Include lower directories
-i Prompt before remove or overwrite
-f Do not prompt before remove or overwrite
-a (ls) Show hidden files
-l (ls) Use detailed format with one line for a file

Wildcards

The letters * and ? are used to specify multiple files in commands above.  Use with sufficient understanding.

Handling background jobs

The completion of a background job will be notified on the terminal when the terminal used to submit the job is still alive.  Since, from a securiy reason, terminal will be automatically disconnected when it is not used for a certain period,  the status of a long-time job needs to be checked by a re-login using the command like top or ps.  Examples of major job-handling commands are summarized below.

Examples of Job-Handling Commands

top
Displays the status of the processors and jobs in a list in read time.  Type q to quit.
ps xuf
Displays the user's processes including the jobs disconnected from a terminal (x) in user-friendly (u) forest (f) format.
kill 121212
Kills the job with ID 121212.  Since a job of quantum chemical calculation is often invoked from hierarchical shell scripts, check the hierarchy and ID's of the jobs carefully, and kill them properly from the upper hierarchy.