Rutgers Univerisity

Laboratory for Computer Science Research/Computing Facility

Unix Reference Card

When You Are In Emacs

When you are in Emacs, editing a file, you might want some commands to help you out. Here are some helpful ones. (In the list below, ^ means to hold down the control key, e.g. ^G means to hold down the control key and type 'g', and M- means to type the escape key before typing the following letter, e.g. M-X means to type the escape key and then type 'x'.)

^X^F(filename) - find a file (then you can put in the name of the file you want to find) and load it into a new emacs buffer.

^X^V(filename) - visit a file (use the same buffer you are currently in, deleting the buffer's current contents.)

^Xi - insert a file in the buffer at this point.

^G - abort (quit) the currently running command.

^X^S - save this buffer into its file.

^X^C - get you out of emacs (kills emacs.) Will ask if you want any of the unsaved buffers saved.

^Z - stops emacs (keeps emacs around: reenter via "%emacs".)

^L - redraws the screen.

^Hm - describe the current mode (this is useful in Rmail mode to describe all the different keybindings.)

M-< - go to the top of the buffer.

M-> - go to the bottom of the buffer.

^X2 - display two windows.

^X4f - find a file in another window. This splits you into two windows.

^Xo - switch between two windows (i.e. go to other window.)

^X1 - display only one window (this window.)

^X0 - (0 is the digit 0) display only one window (other window.)

^Xb(buffer name) - switch to buffer.

^Xk(buffer name) - kills that buffer (this is very different from ^X0 as it actually kills the buffer instead of just removing it from your display.)

Special modes will be entered if the filename extension is correct, e.g. you will be in scribe mode if the file extension is .mss, TEX mode if the extension is .tex or .latex.

Emacs RMail

Note: Most users use Netscape or Outlook/Outlook Express to read their mail, since these tools are, well, better than emacs' rmail mode. However, if you want to use a terminal-based mail reader, and are too tough to use "pine", here's emacs' "rmail mode"

Emacs has special modes for reading and sending mail. You can enter RMail by either typing emacs -f rmail to the shell or typeing M-x rmail once you are in emacs.

Most of the commands are different from the normal emacs commands. Here are some useful commands in Rmail mode (type ^Hm to find out about all the possible commands.)

p - show me the previous message.

n - show me the next message.

d - label the current message as deleted (see the e, s, and q commands for expunging messages.)

m - send a message (this goes into the mode for sending mail.) Send with ^C^C. See below.

M-1r - reply to the current message and copy everyone else on its "cc" list.

f - forward the current message to someone else (goes into the mode for sending mail.)

^C^C - send out the message I just wrote (on in the mode for sending mail.)

g - get new mail that has arrived since entering RMail.

o(Filename) - save the current message into another RMail format file. Don't print these mail files, see the next command.

^O(Filename) - save the current message into a unix mail format file. This can then be printed out using lpr.

e - expunge deleted messages.

s - expunge deleted messages, and save the RMail file. This should be done any time you move to another buffer, or ^Z out of emacs so that you don't lose any messages if the system crashed.

^Xo, ^X1, ^G, ^Xk, and ^X^C - are all useful in RMail mode. See above for explaination.

h - show me a summary of all the headers of the messages in my mail file. his is called mail-summary mode. When you are in the mail summary window, you can use the following commands to see things, get rid of them, etc.
n - move to next undeleted message
p - move to previous undeleted message.
^N - move to next message.
^P - move to previous message.
j - jump to the message at the cursor location.
d - delete the message at the cursor location and move to the next message.
u - undelete the message or previously deleted message.
x - exit and kill the summary window.
space - scroll message in other window forward.
delete - scroll message backward.

Alias files

If you are in the habit of sending one message to a specific group of people, you should have an alias file. In order to do this, at the prompt type emacs .mailrc.

You can now start an alias file, listing groups of poeple who should get the smae message, i.e.
alias friends thompson@cs.rutgers.edu, perrotta@athos
make sure you put the system the person can be reached on and a comma after each name until you get to the end. Do not put a comma at the end of the last name.

Just use the defined alias at the To: prompt when sending mail. The message you want to send will go to all of the people in this file listed under "friends".

You may have many aliases in the .mailrc file. Each definition goes on a separate line.

Help

There are online manual pages for almost every function. To get the man page for any subject, type man {subject}.

To print a copy of a man page, type
man {subject} | lpr

apropos {subject} or man -k {subject} lists all manual pages dealing with subject (searches an index of manual pages.)

To find a list of all the manuals, type:
more /usr/man/whatis
this lists all of the manuals available (this is what apropos uses.)

Shell Commands

^U - erase what you've typed so far on the current command line.

jobs - shows any processes you are running in the background or stopped.

fg - used to restart your emacs or any stopped jobed, if you stop a job.

When you are ready to log out, and you get a message There are stopped jobs, type fg and exit the normal way.

from - who is any new mail I have from.

ls - list the directory.

ls -a - shows all your files, including those starting with '.' (i.e. a period.)

ls -lg(Name of file) - show long format directory listing for specified file including group ownership.

cp (filename) (newfilename) - copy an old file to a new file.

cat (filename) >> (name of another file) - appends one file to another file.

mv (filename) (name of directory) - move a file to a subdirectory.

more (filename) - show the input (in this case, filename), a screenful at a time.

ls -l | more - give a long listing of the directory, a screenful at a time.

lpr (filename) - to print on default printer

lpr -Plp16 (filename) - to print to a specific printer. (In this case, lp16.)

lpr -#3 -Plp7 (filename) - to print three copies of a file on lp7.

lpr -S (filename) - print singlesided when using a doublesided printer.

mpage -l -Plp7 (filename) - to print files in landscape style (horizontal) on postscript printer.

printers - lists printers available on the machine.

!(first letter of last command) - to repeat the last command (only with csh and tcsh).

!! - repeat the last command given.

Making Subdirectories in your directory

cd - gets you back to your home directory.

mkdir Memos - make me a new subdirectory which I want tobe called Memos and in which I can put files.

cd Memos - connect me to the subdirectory Memos.

pwd - print my working directory (the one I am in.)

rmdir (directoryname) - remove the named directory.

Changing Mode of File

chmod g+rw (filename) - change the protections of a file or directory. In this example, it gives the group read and write access.

chgrp (groupname) (filename) - change group on a file.

Still more commands

who - who is on the computer now.

finger (username) - find someone on this machine.

finger (username@hostname) - find someone on specified machine.

groups - shows you which groups you are in.

write (username) - write someone a note quickly without getting into mail. Use ^D to finish. Each line will show up on their terminal as you type CR (carriage return -- note that the recipient must be logged onto the same machine you are for this to work.)

talk (username@hostname) - talk to someone - they can talk back. A ^C gets you out.

File Transfers

ftp - to move files from one system to another. e.g. aramis to remus.

ftp remus - will show you how to get an ftp prompt and you will be asked to log in.

cd (name of subdirectory on remote machine) - if you wish to change your working directory to a subdirectory.

send (filename) - sends the file to the remote machine from the directory to which you are connected.

get (filename) - gets the file from the remote machine; puts the copied file in your current directory with the same filename.

bye - to close the connection to the other machine and exit ftp.

To read Network News

Netnews can currently be read via netscape or outlook express. The LCSR news machines is news-lcsr.rutgers.edu. When asked to authenticate yourself, you can use "username@hostname", where "username" is your username, and "hostname" is "remus", "paul", or "aramis", depending on what cluster of machines your account is active on.

To Play Games

ls /usr/games - shows available games.

Credits

This reference card was published though the Laboratory for Computer Science Research Computing Facility. It was originally compiled by Margarite Thompson, edited by Donald Watrous, David Steiner, and Charles McGrew. The original reference card was typed by Nacy Perrotta.


Last Updated: 17 March 2002