The Most Important UNIX Commands
==========================================================================
!!! In case your command is not recognized, remember that UNIX is CaSeSeNsItIvE !!!!

TOP 50 IMPORTANT UNIX COMMANDS

Command with Common Usage Description
alias [ name [ string ] ] Make name an alias for string
awk script [ file ] See description below
basename [ path ] Return everything after last / in path
bg [ %job-id ] Put job in the background
break Escape from control loop
cat [ file ... ] Concatenate and display files
cd [ dir ] Change working directory
chmod mode file Change permissions mode of file
continue Continue next iteration of control loop
cp source target Copy source file to target file
diff file1 file2 Display differences between file1 and file2
dirname [ path ] Return everything before last / in path
echo [ -n ] string Write string to standard output
exit [ value ] Exit from current shell with optional return value
fg [ %job-id ] Return job to foreground
foreach word ( list ) [ ... ] end Succesively set word to elements in list
grep [ -i ] pattern [ file ] Search for pattern in file
head [ -number ] [ file ] Print first few lines of file
hostname Print name of current host
if ( expr ) [ then ... else ... endif ] Conditional evaluation (else if also supported)
kill [ -signal ] pid Terminate or signal a process
ln -s source [ target ] Make “symbolic” link from target to source
ls [ -alrt ] List contents of directory
make Maintain and regenerate related programs and files
man [ -k ] command Display man page for a command or keyword
mkdir dir Make directory
more [ file ... ] Browse or page through a text file
mv source target Move or rename source to target
nice [ -priority ] command Execute command with specific priority
ps Print information about active processes
pwd Return working directory name
rehash Refresh command search path
renice priority pid Change process priority
rm file Remove file
rmdir dir Remove directory
sed script [ file ] See description below
set [ variable [ = value ] ] Set shell variable to value (opposite unset)
setenv [ VARIABLE [ word ] ] Set environment variable to word (opposite unsetenv)
sort [ file ] Sort lines of text file
source file Execute commands from text file
switch ( expr ) case: [ ... ] endsw Choose from among a list of actions (like in C)
tail [ -number ] [ file ] Print last few lines of file
tee [ file ] Replicate standard output
time command Time a command
top Display information about top CPU processes
touch file Create empty file or update access & mod times
uptime Show system load and how long system has been up
w Display information about logged-in users
wc [ file ... ] Count lines, characters, and bytes in file
whatis command Display summary about a command
which command (also where command) Locate a command; display its pathname or alias
while ( expr ) [ ... ] end Loop while expr true

Deep dive to widely used unix Command Advance
 

Basic File Commands:

_______________________________________________________________________
|                                                                         |
| more filename                  Displays a file on the screen and pauses |
|                                at the end of each screenful. "Spacebare"|
|                                scrolls down one page, RETURN one line   |
|                                at a time options.                       |
| pg filename                    Displays a file on the screen and pauses |
|                                at the end of each screenful. RETURN     |
|                                scrolls down one page                    |
|                                                                         |
| cat filename                   Displays a file on the screen without    |
|                                pausing at the end of the screen. Use    |
|                                <CTRL><S> to stop screen output and      |
|                                <CTRL><Q> to restart output. There will  |
|                                be a time delay before screen output can |
|                                be stopped.                              |
|                                                                         |
| cp filename newfilename        Make a second copy of a file.            |
|                                                                         |
| mv filename newfilename        Renames (moves) a file to a new filename.|
|                                                                         |
| rm filename(s)                 Deletes (removes) one or more files.     |
|                                                                         |
| rmdir directoryname            Deletes (removes) an empty directory.    |
|_________________________________________________________________________|

     Note: On standard UNIX systems there is no built in undelete
           command. If a file is deleted with rm it is gone forever
           unless there is a copy of the file on tape backup.
 

Basic Directory Commands:

__________________________________________________________________________
|                                                                         |
| pwd             Shows your current connected directory.                 |
|                                                                         |
| cd directory    Changes your current connected directory.               |
|                                                                         |
| ls              Gives a directory listing.                              |
|                                                                         |
| ls -l           Gives a long form directory listing including           |
|                 protections and file sizes. See the manual page for ls  |
|                 by typing man ls if you are interested in other options |
|                 to the ls command.                                      |
|                                                                         |
| chmod filename  Changes permissions to read, write or execute a file    |
|                 e.g.: "chmod 777 *" gives read, write and execute       |
|                 permission to everyone and to all files in the directory|
|                  *="joker", for more information see                    |
|       http://www.sp.uconn.edu/workshops/unix.shell.basics.workshop.html |
|                                                                         |
| ls -a           Gives a directory list of all files in the directory,   |
|                 including files which start with a ".". These are       |
|                 typically parameter files and are normally invisible.   |
|                                                                         |
| du              Shows the disk usage of the current directory.          |
|                                                                         |
| mkdir           Makes a new directory                                   |
|                                                                         |
| rmdir           Removes an existing empty directory.                    |
|_________________________________________________________________________|
 

   One should also be aware of the use of the following UNIX directory
   abbreviations:

       ____________________________________________________
      |  .   Current working directory                     |
      |                                                    |
      | ..   Parent directory of current working directory |
      |                                                    |
      | $HOME User's home directory                        |
      |____________________________________________________|
 

Commands for Aborting Programs:

Usually it is best to leave programs using the quit or exit commands, however
occasionally it is necessary to terminate a running program. Here are some
useful commands for doing this:

__________________________________________________________________________
|                                                                         |
| <CTRL><C>     Aborts a running program without the option of restarting |
|               it later.                                                 |
|                                                                         |
| <CTRL><Z>     Pauses a program and returns the user to the genes%       |
|               prompt. The program can be restarted by typing fg         |
|               (foreground). If you type bg (background) the job will    |
|               also be started again, but in background mode.            |
|                                                                         |
| kill psid     Kills a process with the given process ID. This number is |
|               obtained using the ps command.                            |
|                                                                         |
| <CTRL><D>     Terminates a UNIX shell such as csh or sh. Use logout to  |
|               exit from your top level login shell. This command only   |
|               work at the genes% prompt.                                |
|_________________________________________________________________________|
 

    Here are some commands which give information about your login
    sessions and jobs which you are running:

__________________________________________________________________________
|                                                                         |
| uptime     Prints the current time, the length of time the computer has |
|            been running since the last shutdown, the average number of  |
|            users on the system, and the average system loads over 1, 5, |
|            and 15 minutes.                                              |
|                                                                         |
| ps         Shows your current processes and their status (running,      |
|            sleeping, idle, terminated, etc.).                           |
|                                                                         |
| jobs       Shows your active jobs and their status (running or stopped).|
|                                                                         |
| top        Shows the most active processes on the entire machine and the|
|            portion of CPU cycles assigned to running processes. Press   |
|            "q" to quit from top.                                        |
|_________________________________________________________________________|
 

UNIX Command Summary:

Here is a reference list of some common UNIX commands.

___________________________________________________________________________
|_Command_________Function________________________________________________|
|                                                                         |
| <CTRL><C>       Aborts a command or program.                            |
| <CTRL><D>       Terminates a UNIX shell level; closes a file.           |
| <CTRL><>       Toggles terminal scrolling.                             |
| <CTRL><S>       Stops terminal scrolling.                               |
| <CTRL><Q>       Continues terminal scrolling.                           |
| <CTRL><Z>       Suspends running job.                                   |
|_________________________________________________________________________|
|                                                                         |
| at              Submit script to the at queue for execution later.      |
| atq             Lists jobs waiting in batch queue                       |
| atrm            Removes a job from the at queue.                        |
| bg              Resumes a suspended job in background mode.             |
| cat             Shows file on screen. Can also be used to concatenate   |
|                 file.                                                   |
| chmod           Sets file or directory protections.                     |
| chsh            Changes login shell declaration.                        |
| cp              Copies files.                                           |
| du              Shows disk usage of a directory and its files.          |
| emacs           Enters the emacs full screen text editor.               |
| fg              Brings a background job back into interactive mode.     |
| finger username Identifies a user.                                      |
| groups          List the privilege groups to which a user belongs.      |
| jobs            Shows active jobs and their status.                     |
| kill            Kills a running process.                                |
| logout          Ends your terminal session with ICGEBnet.               |
| ls              Shows listing of files belonging to a directory.        |
| ls -a           Shows listing of files including hidden files.          |
| ls -l           Shows verbose listing of files including protections,   |
|                 size, date created, and originator.                     |
| man command     Shows the on-line manual page for a UNIX command.       |
| more            Shows a file stopping at the end of each page.  Can also|
|                 move backwards or search for a specific pattern.        |
| mv              Renames (moves) a file.                                 |
| passwd          Changes account password.                               |
| ps              Shows your processes and their status.                  |
| quota           Shows disk usage and permanent and working disk quotas. |
| rm              Removes (deletes) files.                                |
| script          Records terminal output to a file.                      |
| stty            Sets various terminal parameters.                       |
| talk            Interactively converse with another logged-in user.     |
| top             Shows the most active processes on the system.          |
| umask           Sets the file creation mask for file protections.       |
| w               Lists current logged-in users.                          |
| who             Lists current logged-in users.                          |
| whoami          Lists your username.                                    |
|_________________________________________________________________________|
 

The ancestor of this file was obtained from genes.icgeb.trieste.it