Note: This document provides a quick summary of some Unix basics. More extensive documentation is available from the Clemson DCIT
Unix Reference page. Additional Unix documentation is also available from DCIT.

Here are some useful unix commands that you can use at a Unix prompt.
pwd - print working directory
cd - change directory (same as Dos)
ls - list directory contents (same as dir in Dos)
mkdir- make a new directory (same as Dos)
rmdir- remove (delete) an empty directory (same as Dos)
rm - remove (delete) a file (same as del in Dos)
mv - move (rename) a file (same as ren in Dos)
man - display manual (documentation) entry

Additional information on this page includes:
Executing a program
Retrieving previous commands

pwd

To display the name of the directory you are currently in:
Type pwd followed by the Enter/Return key.
Example:
  stormy10[40] pwd
  /home/userid
  stormy10[41] 
Back to top

cd

To change to your home directory:
type cd ~ followed by Return/Enter.
Example: (Change from the current directory to /home/userid)
  stormy10[42] cd ~		(or you could omit the ~)
  stormy10[43] 
To go back one directory:
type cd .. followed by Return/Enter.
Example: (Change from /home/students/userid/102/labs to /home/students/userid/102)
  stormy10[43] cd ..
  stormy10[44] 
To change to subdirectory foo (in the current directory):
type cd foo followed by Return/Enter.
Back to top

ls

To view a list of file and directory names:
type ls and Return/Enter.
Example: (Display the file and directory names of the current directory.)
  stormy10[44] ls
  labs    sec1    sec3    sec5
  stormy10[45] 
Notes:
use ls -l to get a full listing (like dos)
use ls -a to see hidden (name begins with .) files
use ls -la to see a full listing with hidden files
Back to top

mkdir

To create a directory:
type mkdir <name> and Return/Enter.
Example: (Create a directory called junk.)
  stormy10[47] mkdir junk
  stormy10[48] 
Back to top

rmdir

To delete an empty directory:
type rmdir <name> and Return/Enter.
Example: (Delete an empty directory called junk.)
  stormy10[47] rmdir junk
  stormy10[48] 
Back to top

rm

To delete a file:
type rm <name> and Return/Enter.
Example: (Delete a file called junk.java.)
  stormy10[47] rm junk.java
  stormy10[48] 
Back to top

mv

To rename (move) a file:
type mv <currentname> <newname> and Return/Enter.
Example: (Rename file hello.jav to Hello.java.)
  stormy10[47] mv hello.jav Hello.java
  stormy10[48] 
Back to top

man

To access the manual page for a command:
type man <command> and press Return/Enter.
Example: (View the manual page for ls.)
  stormy10[45] man ls
 
  ls(1)                     User Commands                     ls(1)
 
  NAME
       ls - list contents of directory
			.
			.
			.
  --More--(15%)
Note: Press the space bar to view the next page. Type q to quit the listing.

Back to top

Executing a program

To run a program:
type the program name (or the name of the file that contains the program).
Example: (Run the vi editor.)
  stormy10[47] vi
   
  ~
  ~
  ~
  ~
  ~
  Note: You are now in vi



Back to top

Retrieving previous commands

tshell (which is the default for 102 accounts) automatically remembers each command that is typed. So, instead of retyping a command previously used, simply use the up arrow key to scroll through the list of previously used commands. (There is a limit on the number of previous commands remembered.)

Note: This works basically the same as doskey, but it doesn't have to be installed. It is part of the OS. Also, in tshell, if you type !v, the most recent command starting with a v will be executed. !j will run the most recent command starting with a j, and so on.

Back to top