Useful Unix Commands


 

cd

Go to your home directory
cd directory
Go to this directory
cd ..
move up one directory
cp [-i] file directory
Copy file to directory
cp –i file directory
Copy file to directory but check for existing file
man command
Get help for command
ls [-aFl]
List contents of a directory
a – all files (shows hidden files)

f – show file types ( * is an executable …)

l – show long file listing

mkdir directory
Make a new directory
rmdir directory
Remove a directory (must be empty)
mv oldfile newfile
Rename oldfile to newfile
lp file
Print file
rm [-ifr] file
Remove file
i – ask before deleting

f – delete files without inquiring

r – recursively traverse directories and their contents

Be careful typingrm –r *in your home directory

|
Pipe output of one program to the input of another

EX:>ls –alF | more

Will list the contents of the current directory one page at a time

grep [-i] searchpattern [file …]
Search files for test
-I-- ignore upper and lower case
Pwd
Print current working directory
find startdir directives   Find searches a directory tree to find files that match criteria given
  by directives.

  EX:  >find ~/ -name javaresources.htm
           Will attempt to find javaresources.htm starting in your
            home directory.  Find can sometimes be quite slow.

         >find ~/ -name "*.html" -print
           Will search for all .html files in your home directory.

 

Useful Emacs Commands


 

Ctrl-X Ctrl-C

Quit emacs
Ctrl-H or backspace
Get help
Ctrl-N
Move cursor down one line
Ctrl-P
Move cursor up one line
Ctrl-A
Move cursor to beginning of current line
Ctrl-E
Move cursor to end of line
Escape-<
Move cursor to beginning of file
Escape->
Move cursor to end of file
Ctrl-X Ctrl-S
Save file
Ctrl-X Ctrl-F
Load new file for editing
Ctrl-X Ctrl-B
Show list of buffers (open files)
Ctrl-X filename Enter
Switch to filename
Ctrl-X K
Kill current file
Ctrl-S text Enter
Search forward for text
Ctrl-R text Enter
Search backwards for text
Ctrl-X 2
Split current window in two
Ctrl-X 1
Make the current window the only one
Ctrl-X 0
In Xemacs – remove all other frames
Ctrl-X 50
In Xemacs – remove current frame
Escape-% old Enter new Enter
Start searching forward and replace occurrence of old with new

(c) Chris Patel, August 2000

The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees