Stats UNIX Selected Cmd Summary
at William and Mary
(By Bob Dawson, Academic User Support)

Table of Contents

Introduction

Selected Cmds

Archive Files/Dirs
Background a Job
Cancel a Fg Job
Copy File
Concat Files
Edit with XEMACS
Edit with PICO
Foreground a Job
Help
List Files
List Jobs
List Processes
Logout
Kill a Job
Move Filename
Move Files to Dir
Move Directory
No Hang Up Job
Page Display
Password Change
Redirect Cmd1 to Cmd2
Redirect to File
Remove Files
Rename File
Set
Suspend Fg

Introduction
The following is a summary list of selected UNIX cmds. In a cmd format, the items in "[]"s are optional and are also selected (not exhaustive for a give cmd); the same holds for items in "{}'s except that they are not optional: at least one item is required, one item only if the "{}" item list ends with "or", one or more if items represented by a name that ends with "(s)". A "files" notation stands for filename or wild card filename. Finally, there are frequently more than one application of a cmd than indicated.
 

Cmd-Name Format Description
Archive Files/Dirs
 
tar {ctx} [v]f tarfile files/dirs
Note: tar= "tape archive" for
times when tapes were in.
Arhives/Extracts files/directories to/from a tar file; "
Background a Job
 
{bg %n or cmd&} "bg %n" puts suspended job "n" in background ("n" defaults to currently suspended); "n"= job's list no. in []'s displayed via "jobs" cmd. "cmd&" puts "cmd" job in background when "cmd" executed.
Cancel Fg Job Ctrl-c  Cancels (kills) current foreground job.
Copy File cp [-i] f1 f2 Copies file "f1" to "f2" if "f2" not write protected. "-i" asks if ok should "f2" exists while not write prot.
Concat Files
 
cat filelist  Concatenates and displays without paging all files specified in "filelist" (list of filenames and/or wildcard names); popularly redirected with ">" to a single file (e.g., "cat my.dat my2.dat > allmy.dat" puts files "my.dat "&" my2.dat" in file "allmy.dat".
Edit with XEMACS
 
xemacs file Edits "file" with X-Windows EMACS editor. "Ctrl-x Ctrl-c" = exit, with opt to save; "Esc ? ? Ctrl-h" = help summary; "Esc ? t" = tutorial; must be in X-Windows mode.
Edit with PICO
 
pico file  Edits "file" with PICO, the "PINE" mailer editor. Ctrl-g gets help; major cmds & their keys listed at screens bottom;  X-Windows mode not required.
Foreground a Job
 
fg %n Puts job "n" (suspended or backgrounded) in foreground; "n"= job's list no. in []'s displayed via "jobs" cmd.
Help
 
man {cmd, language} "man" displays help for a "cmd" or "language", where  "cmd" = a  Stats's cmd name (like "ls") and  language = a programming language name (like "f77" for Fortran). 
List Files
 
ls [-la] files  Lists names of "files" (default, all but hidden files). "-l" long lists "files" with extra info (prot. codes, dates, etc.); "-a" lists all "files" including hidden files (those that begin with a "." period (like " .profile"). Examples:. "ls *.dat" lists name of all files ending in ".dat".
List Jobs
 
jobs  Lists suspended and background jobs; integer in []'s identifies job for foregrounding, suspending, & killing.
List Processes
 
ps [-l] Lists all user's processes: suspended jobs, background jobs, this "ps" cmd job, and other processes such as the UNIX  login process; "-l" includes extra info such as time.
Logout  ) logout or exit or Ctrl-d Logs out of a Stats  login session (no msgs; just goes dead.)
Kill a Job
 
kill %n Kills job "n" ("n" = job no. in "jobs" cmd display).
Move Filename
 
mv [-fi] old new Moves (renames) filename "old" to "new". If "new" exits, "-f" forces move while "-i" asks if ok to move.
Move Files to Dir
 
mv [-fi] files dr Moves "files" to directory "dr"; "-f" forces move over existing write protected file; "-i" asks if ok.
Move Directory
 
mv dr1 dr2 Moves (renames) directory "dr1" to "dr2" if "dr2" non exists; else moves "dr1" to subdirectory of "dr2".
No Hang Up a Job
 
nohup cmd & Runs "cmd" job in the backup, continuing after log out until completion.
Page Display
 
more file Displays file "file" in pages; ENTER scrolls a line, SPACE scrolls a page; "MORE %" display prompts scroll.
Password Change
 
passwd [-s] Changes login password; "-s" displays password info.
Redirect Cmd1 
to Cmd2
 
cmd1 | cmd2 Redirects (pipes) "cmd1" output to "cmd2" input (e.g., "ls -l" | more" pipes the "ls -l" long filename list to the "more" cmd, which displays the list in pages.)
Redirect to File
 
cmd {> or >>} fi Redirects "cmd" output from terminal to file "fi". ">" stores over existing "fi"; ">>" appends to existing "fi"; redirection fails if "fi" write protected (e.g., "ls > fl" sends filename list to file "fl"; "ls >> fl" adds list to file "fl"; neither works if "fi" write protected.)
Remove Files
 
rm [-i] files Removes all "files". Asks if ok when "-i" used or file write protected.
Rename File
 --see Move Filename above 
Set
 
set Displays all set variables (e.g., var HOME="/home/user-id/" -- home dir).
Suspend Fg
 
Ctrl-z Suspends foreground job (resume with "fg" or "bg" cmds).