9CV"'~ e t- , t- e)<t- F: l-e
1 S o: \Nk,'G~
•
(J..._ seX of. ;IAS\v-~OIl\.S' ~v- ~e.. w ~ e. 01\ yo \II. e)( e. G.\A. t- ~ yo LA. V" P y ~ 0 ~ 5 G. (/"; f t J t'k e.
----- 0.\\ \A.V\(h,rlMiy - ;",-a~eJ. (;IAe.s ~llow;J if 5Me~
(0'; et~ ocr eL5t. 5W-~~) \iV,'lI b{L e)Cec.vJ-~
For
V\
-
t
,< COlA..s>
r
wh.'\-e_
w~;\e ~pv~ > "t c~-
\
:< COlA 5 '>
I
----
--
tn ~ V~IAe. ;V\ ftte.
L' 5 i- Ct ~ ftr v-eQo.-cA
J
V't-b,'v"-t\,''''-j J ex e.c..u,ke5 <co vt.S '>
e.. ,>u:.c..J-e s <c" "'-s"> i ~ < pol'eJ... > 15 TY'vte'
_)
o..ft e- -e.2<-e c..vJ-,'oV\ of <COV\5> V' e - t- est J
)
< pV'eJ) ~ v:« - e l.<. e c.v-k e S < CoV\.5 > /'{
<pv~ '> ;5 5 t; Il tV'lAe •
5o.w..p [e. ;
n=-@
""h;le V\<.2.: l- ~ pr,'V'\ + n _j
n t-:: I e - Q (6 v.- S [00,0 fr, b~ bV'ok.~
web "M; t-. dv./olh I poc:\c.et R~ (poclc.eJ Rtf 2.005'. r ot f
Working with Directories and Flies
Display name of current working directory Display name of your home directory Change current working directory to dir
(if no dir is specified, uses your home directory)
Create new directory named dir
Remove empty directory named dir
List files in current directory
List specific file/directory; options include:
-a list all files, including "dotfiles"
(i.e., files with names beginning .) -F list files showing types (in listing,
/ = dir, * = executable, @ = link)
-I list with long information (mode bits,
owner, size, date, name, etc.)
Display file contents all at once
Display first n lines offile (if -n omitted, uses 10) Display last n lines offile (if -n omitted.uses 10) Display file one screenful at a time; once started:
Spacebar move forward one screenful
Return move forward one line
b move back one screenful
/string go to next line containing string
? help
q or Ctrl-c quit
Make a copy of file/directory at new location Move (rename) file/directory to new location
Mark file/directory for later permanent removal (file/directory renamed with prefix of .#)
Recover file/directory marked for removal
List files/directories marked for removal PERMANENTLY remove files/dirs marked for removal in directory dir (if dir omitted, uses current dir) PERMANENTLY remove files/dirs marked for removal in home directory and all sub-directories PERMANENTLY remove file immediately (-i option has command ask for confirmation; be careful!) NOTE: If you' accidentally remove a file using expunge, purge, or rm, but the file existed previously, you may be able to recover it from the OlcIFiles directory in your home directory. (OlcIFiles is an Athena-generated backup copy of your locker).
pwd echo$HOME
cddir
mkdirdir rmdirdir
Is
Is options file-or-dir
cat file head -n file tail -n file more file
cp fromfile tojile mv fromfile tofile
delete file-or-dir
undelete file-or-dir Isdel
expunge dir
purge
rm -i file
Creating New Flies
You typically create new files from within application programs (e.g., using the New or Save option from a pull-down menu of a program you're working in). To create a simple text file, however, you can use the following shortcut (see also the other redirection techniques on p. 9):
cat> file Create a new file by directly entering lines of text;
lines of text... if you make a mistake, delete the file (see above)
C-d and start again, or edit the file in a text editor;
to add text to an existingfile, use» rather than>
For more complex text files, use Emacs (p. II) or OpenOffice (see p. 10).
6
Emacs on Athena Reference Card
VersionS September 1993 AC.43
Starting the Editor
To create a new Emacs window for editing: emacs&<
emacsfik_&<
emacs swiIc/N, &
where filename is the name of the file for editing, which mayor may not exist. and where switches can be any combination of:
-" use reverse video
-font fontname use fontname instead of default "vtsmgle"
_etry width wight >XD/!:yoff
specify size and position of window
example:
emacs·rv ._"-"IIOxS5+30+10fik_ &<
You can also start Emacs from the Text submenu of the Textl Graphics menu of the dash menu bar. For more options. type mao .......
Exiting the Editor
C-xC-c
exit (will prompt to save modified buffers)
Getting Help
Type C-h and follow the instructions. If you are a first time user, type C-b t for a tutorial.
C-h a apropos: show commands matching string
C-h m get mode-specific infonnation
C-8Itill·MIDDLE pop-up help menu
M-C-v scroll Help window
c« 1 hide Help window
SearclJing
C .. C·r
search forward seao:h backward
Emacs prompts for search string. then finds it incrementally as you enter it Fix typos with DELETE key. Valid actions:
C ..
c-e Esc:orFll C.g
C·"
C·y
look for next occurrence seao:h backwards
end search (keep cursor at position) cancel search (go back to start)
grab word afret cursor as search string grab rest of current line as search string
Replacing M·% C-xEK
interactively replace a text string restart query-replace with same strings
Emacs finds each occurrence and prompts for action. Valid actions:
Space
replace this occurrence replace this, then exit
replace this and display result skip to next without changing exit without doing any more
replace the remaining without prompting go back to the previous occurrence
enter recursive editing mode
(C-M-c to exit)
display these options
Delete EleorFII
C·r
C·b
Oa tbiJ c:anl, aa in most Atbeaa documeDtatioD, 1bc following coaveDtioas areullCd:
C-x (CIrk-) preSIX while boJdins dowD c-troI (CII'I) key
M-... prell x wtM hokiiug down. Mda (CcIIapM CbIIneter,
• ee.po., AIt, 01'.) key; or UI Emacs 011 DEC and IBM wab:Wioas. prell and release the E.: or Fll key, dIeD press ....
pre .. Jtetam 01' Eutr ill maiD keybomd ares
pn:ss tbe key .orllel.ftbe upperrigbtCOl'lla"oftbe main keyboanIlabeled Ita&:bpMe or <Xl, lIOl Delete Icrtmoute buttoD
LEn MIDDLE .. GBT
CopyriabtC 1993 MuudwscUs 1Ds~ ofTedmolosY
®
Error Recovery
Cog cancel any command. get out
Cox u undo the last command
C-I redraw garbaged screen
M-x recover-ftle recover a file lost by system crash M-x revert-buffer restore a buffer to original contents
Moving the Cursor
M·I M·b
C·por! Coo or ~
M ... M ..
M.( M·l
C·v M·v C-x< Cox>
M-< M->
LEFT
Inserting Text
type at cursor Return Return
move forward one character move back one character
move forward one word move back: one word
move to previous line move to next line
go to beginning of current line go to end of current line
go to linen
go to beginning of current sentence go to end of current sentence
go to beginning of current paragraph go to end of current paragraph
scroll to next screen scroll to previous screen stroll screen left
scroll screen right
go to beginning of current buffer go to end of current buffer
exchange cursor with mark
move emacs cursor to mouse position
C-q control-char insert control character
M-x insert·buffer bring in text from other buffer Cox i bring in text from external file
change word to uppercase change word to lowercase capitalize word
change region to uppercase change region to lowercase
transpose current and previous char transpose current and previous word transpose current and previous line
check current wont check: all words in region check: all words in buffer
Text mode must be on to use the fill commands.
M-x text-mode enter text mode
C-u n Cox f set right margin to column n
M-x auto-fill tum auto fill mode on or off
(off by default)
M.q fiU paragraph
M-g fill region
M-s center on line with respect to fill
Minibuffer
Tab Space Retum
These keys are defined in the minibuffer:
C.g
complete as much as possible complete up to one word complete and execute
show possible completions abort command
Marking a Region
A region is all the text between a mark and the cursor.
C·Space c-s c« M·@ M·b C-xC-p C-xh
Deleting and Killing
set mark here
exchange point and mark set word mark
set paragraph mark set page mark
set buffer mark
Killed text is placed into the kill buffer and can be retrieved. Deleted text is not placed into the kill buffer, thus is not retrievable. Forward kills include the text currently under the cursor, backward kills do not. You can use kill and yank to move text.
De .... Cod
C·k C·u0 C·k
M·k
Cox Delete
C·", M·w
M·zc
C-u- M-zc
C·y
C-u2 C-y C·yM·yM·y ...
MIDDLE
RIGHT
SbIII·MIDDLE
C·MIDDLE
Files c-s c-e C·xi
delete previous character delete current character
kill word forward kill word backward
kill line forward kill line backward
kill sentence forward kiJI sentence backward
kill region copy region
kill ( zap) forward to character c kill (zap) backward to character c
yank back (restore) last thing killed yank back next to last thing killed cycle through previous kills
paste text from X cut buffer to mouse cursor
copy text between Emacs and mouse cursor into X cut buffer
copy text between Emacs and mouse cursor into X cut buffer, and the Emacs kill ring
cut text between Emacs and mouse cursor into X cut buffer and the Emacs kill ring
read new file into new buffer insert contents of another file into
this buffer
C-x Cos save current buffer into same file
C-s s prompt to save all modified buffers
Cox CaW write buffer to specified file
M-x write-region save rnuked region.as a file
Buffers
C-xb C-xC-b or C-Shlft-LEFf C-xk
Windows C-xl
c·. 0 (vzero") C·. 2 OR C-RIGHT C-xS
C-x"
C-x0 ("oh'') C-M-v C-u-C·M-v c-s-e
Cox>
Macros
select another buffer 1ist all existing buffers
delete a buffer
hide all other windows
hide window the cursor is in split window in two horizontally
split window in two vertically enlarge window
move to other window scroll other window down scroll other window up scroll window right