You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Introduction to <strong>Unix</strong><br />
! Brackets<br />
move to a matching bracket () {} [] (%)<br />
! Indent<br />
indent a line by one tab >>, un-indent 'a, indent 5 lines 5>><br />
indent a block of C code <strong>with</strong> {} >%<br />
! Misc<br />
redraw screen<br />
^L<br />
join current and next line J<br />
change case of one letter ~<br />
repeat last command .<br />
undo last change u, all changes on line U<br />
! Exit<br />
Save and Quit :wq or ZZ<br />
Write a copy :w<br />
Write to filename :w newfile<br />
Write section of file :w'a, .w! newfile<br />
Quit :q<br />
Quit and force it :q!<br />
Edit ano<strong>the</strong>r file :e file<br />
Edit next file :n (vi filel file2 ...)<br />
Insert ano<strong>the</strong>r file :r file<br />
! Shell commands inside vi<br />
execute shell command :!cmd args<br />
jump into shell :sh (return <strong>with</strong> "exit")<br />
insert output from cmd :r !cmd args<br />
output to shell cmd :w !cmd args<br />
! Vi options<br />
show current settings<br />
indent mode<br />
ignore case searching<br />
set terminal type<br />
show line numbers<br />
wrap line at edge<br />
:set all<br />
:set auto indent<br />
:set ignorecase<br />
:set term=vtl00<br />
:set number<br />
:set wrapmargin=0<br />
Options can be set from shell or .profile.<br />
EXINIT="set redraw autowrite autoindent<br />
wm=0 ts=8"<br />
export EXINIT<br />
! Insert mode commands<br />
backspace one word ^W<br />
back one indent ^D<br />
enter non-printable char ^Vc<br />
! If you botched it<br />
If you hit <strong>the</strong> wrong key... type to abort<br />
If you accidentally altered something ...type U<br />
If you moved somewhere ...type " to return back<br />
Kernel & Utilities<br />
The Kernel resides in memory, while <strong>the</strong> Utilities reside on disk -loaded into memory on request<br />
! Logging In<br />
The init program automatically starts up a getty for each terminal port on a system. getty determines <strong>the</strong> baud<br />
rate and displays <strong>the</strong> login: message. Whet someone types <strong>the</strong>ir login name getty starts <strong>the</strong> login program which<br />
checks <strong>the</strong> password <strong>with</strong> <strong>the</strong> entry in /etc/passwd. If successful <strong>the</strong> users default shell is activated.<br />
The Shell is responsible for:<br />
- program execution<br />
- variable and file name substitution<br />
- I/O redirection < > >>