1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
\r
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
\r
6 <meta name="generator" content="AsciiDoc 7.1.2" />
\r
7 <style type="text/css">
\r
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
\r
11 border: 1px solid red;
\r
16 margin: 1em 5% 1em 5%;
\r
21 text-decoration: underline;
\r
39 h1, h2, h3, h4, h5, h6 {
\r
41 font-family: sans-serif;
\r
43 margin-bottom: 0.5em;
\r
48 border-bottom: 2px solid silver;
\r
51 border-bottom: 2px solid silver;
\r
61 border: 1px solid silver;
\r
66 margin-bottom: 0.5em;
\r
76 font-family: sans-serif;
\r
83 font-family: sans-serif;
\r
87 font-family: sans-serif;
\r
89 border-top: 2px solid silver;
\r
95 padding-bottom: 0.5em;
\r
99 padding-bottom: 0.5em;
\r
103 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
\r
104 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
\r
105 div.admonitionblock {
\r
108 margin-bottom: 1.5em;
\r
110 div.admonitionblock {
\r
112 margin-bottom: 2.5em;
\r
115 div.content { /* Block element content. */
\r
119 /* Block element titles. */
\r
120 div.title, caption.title {
\r
121 font-family: sans-serif;
\r
125 margin-bottom: 0.5em;
\r
131 td div.title:first-child {
\r
134 div.content div.title:first-child {
\r
137 div.content + div.title {
\r
141 div.sidebarblock > div.content {
\r
142 background: #ffffee;
\r
143 border: 1px solid silver;
\r
147 div.listingblock > div.content {
\r
148 border: 1px solid silver;
\r
149 background: #f4f4f4;
\r
153 div.quoteblock > div.content {
\r
154 padding-left: 2.0em;
\r
160 div.verseblock + div.attribution {
\r
164 div.admonitionblock .icon {
\r
165 vertical-align: top;
\r
168 text-decoration: underline;
\r
170 padding-right: 0.5em;
\r
172 div.admonitionblock td.content {
\r
173 padding-left: 0.5em;
\r
174 border-left: 2px solid silver;
\r
177 div.exampleblock > div.content {
\r
178 border-left: 2px solid silver;
\r
182 div.verseblock div.content {
\r
186 div.imageblock div.content { padding-left: 0; }
\r
187 div.imageblock img { border: 1px solid silver; }
\r
188 span.image img { border-style: none; }
\r
192 margin-bottom: 0.8em;
\r
197 font-style: italic;
\r
199 dd > *:first-child {
\r
204 list-style-position: outside;
\r
207 list-style-type: lower-alpha;
\r
210 div.tableblock > table {
\r
211 border: 3px solid #527bbd;
\r
214 font-family: sans-serif;
\r
223 margin-bottom: 0.8em;
\r
226 vertical-align: top;
\r
227 font-style: italic;
\r
228 padding-right: 0.8em;
\r
231 vertical-align: top;
\r
235 div#footer-badges { display: none; }
\r
237 /* Workarounds for IE6's broken and incomplete CSS2. */
\r
239 div.sidebar-content {
\r
240 background: #ffffee;
\r
241 border: 1px solid silver;
\r
244 div.sidebar-title, div.image-title {
\r
245 font-family: sans-serif;
\r
248 margin-bottom: 0.5em;
\r
251 div.listingblock div.content {
\r
252 border: 1px solid silver;
\r
253 background: #f4f4f4;
\r
257 div.quoteblock-content {
\r
258 padding-left: 2.0em;
\r
261 div.exampleblock-content {
\r
262 border-left: 2px solid silver;
\r
263 padding-left: 0.5em;
\r
266 <title>zsh-workshop - 20061128</title>
\r
270 <h1>zsh-workshop - 20061128</h1>
\r
273 <div class="sectionbody">
\r
274 <p>The following documentation is <strong>not</strong> a full documentation of the zsh
\r
275 workshop, it just documents some general stuff which might be useful for
\r
276 workshop participants. Notice: some configuration/keybindings/… are not
\r
277 set up on default zsh but used in <a href="http://grml.org/">grml</a>'s
\r
281 <div class="sectionbody">
\r
282 <p><em>'Zsh is a shell designed for interactive use, although it is also a
\r
283 powerful scripting language. Many of the useful features of bash, ksh, and
\r
284 tcsh were incorporated into zsh; many original features were added. </em>'</p>
\r
285 <div class="literalblock">
\r
286 <div class="content">
\r
287 <pre><tt>-- http://zsh.dotsrc.org/</tt></pre>
\r
289 <p>Merges the best from ksh, csh and bash! (<em>emulate sh + emulate ksh</em>)</p>
\r
290 <p>More than 100 builtins, ~150 options + >300 keybindings</p>
\r
292 <h2>Configuration files</h2>
\r
293 <div class="sectionbody">
\r
294 <div class="literalblock">
\r
295 <div class="content">
\r
296 <pre><tt>wget -O ~/.zshrc http://hg.grml.org/grml-etc-core/raw-file/tip/etc/skel/.zshrc
\r
297 wget -O ~/.zshrc.global http://hg.grml.org/grml-etc-core/raw-file/tip/etc/zsh/zshrc</tt></pre>
\r
300 <h2>Useful modules and settings</h2>
\r
301 <div class="sectionbody">
\r
302 <div class="literalblock">
\r
303 <div class="content">
\r
304 <pre><tt>% setopt autocd && /tmp # cd /tmp
\r
305 % setopt append_history share_history histignorealldups</tt></pre>
\r
307 <div class="literalblock">
\r
308 <div class="content">
\r
309 <pre><tt>% autoload -U zmv # zmv "programmable rename"
\r
310 % zmv '* *' '$f:gs/ /_' # Replace spaces in filenames with a underline</tt></pre>
\r
312 <div class="literalblock">
\r
313 <div class="content">
\r
314 <pre><tt>% autoload run-help # esc-h
\r
315 % autoload compinit && compinit
\r
316 % autoload -U zed</tt></pre>
\r
318 <div class="admonitionblock">
\r
321 <div class="title">Tip</div>
\r
323 <td class="content">run <em>setopt ksh_option_print && setopt</em> to get a listing of all
\r
324 current settings</td>
\r
328 <h2>Globbing / Glob Qualifier</h2>
\r
329 <div class="sectionbody">
\r
330 <div class="literalblock">
\r
331 <div class="content">
\r
332 <pre><tt>% setopt extendedglob
\r
333 % ls -d *.^c # list all files excluding c-source files
\r
334 % ls /etc/*(@) # list symlinks only
\r
335 % ls -l *.(png|jpg|gif) # list pictures only
\r
336 % ls *(*) # list executables only
\r
337 % ls /etc/**/zsh # which directories contain 'zsh'?
\r
338 % ls **/*(-@) # list dangling symlinks
\r
339 % ls **/*(/^F) # list empty directories</tt></pre>
\r
341 <div class="admonitionblock">
\r
344 <div class="title">Tip</div>
\r
346 <td class="content">run <em>H-Glob</em> on your grml system for getting help regarding globbing</td>
\r
350 <h2>Keybindings</h2>
\r
351 <div class="sectionbody">
\r
352 <p>Some very interesting ones (besides default <em>bindkey</em>):</p>
\r
353 <div class="literalblock">
\r
354 <div class="content">
\r
355 <pre><tt>CTRL-d complete / EOF
\r
356 CTRL-l clear-screen
\r
357 CTRL-w delete last word
\r
359 TAB complete and take first result
\r
360 ESC-. insert last parameter of last typed command (similar to typing !$)
\r
361 ESC-e edit the current line in $EDITOR
\r
362 ESC-h call run-help for the 1st word on the commandline
\r
363 ESC-m insert last typed word
\r
364 CTRL-E d insert a timestamp on the commandline (yyyy-mm-dd)
\r
365 CTRL-a begin of line
\r
367 Alt-' quote-line => ''
\r
368 Alt-<number>-char insert <number> of chars
\r
369 Alt-? which-command
\r
370 CTRL-x+a complete alias
\r
371 CTRL-x+e complete word
\r
374 CTRL-w copy last word
\r
375 CTRL-y yank (insert kill-ring)</tt></pre>
\r
377 <div class="admonitionblock">
\r
380 <div class="title">Tip</div>
\r
382 <td class="content">run "bindkey <em>ctrl-v <keys></em>" to find out which action is bount to a key</td>
\r
387 <div class="sectionbody">
\r
388 <div class="literalblock">
\r
389 <div class="content">
\r
391 % !23 # Re-execute history command 23
\r
392 % ^foo^bar # edit previous command replace foo by bar</tt></pre>
\r
394 <p>Check your history for most frequently used commands and create
\r
395 aliases/functions for them!</p>
\r
396 <div class="literalblock">
\r
397 <div class="content">
\r
398 <pre><tt>% print -l -- ${(o)history%% *} | uniq -c | sort -nr | head -n 10</tt></pre>
\r
401 <h2>"Unsorted Must Knows"</h2>
\r
402 <div class="sectionbody">
\r
403 <div class="literalblock">
\r
404 <div class="content">
\r
405 <pre><tt>% rehash # important for bash-users
\r
406 % ls /u/s/d/x/exa<TAB> # try it :)
\r
407 % dpkg -i ~deb/foo.deb # hash for /var/cache/apt/archives
\r
408 % ls ~doc # hash /usr/share/doc
\r
409 % ls =vim # ls $(which vim)
\r
410 % sort <f{oo,ubar} # cat foo fubar | sort
\r
411 % less <(gzip -cd foo.gz) # gzip -cd foo.gz && less foo
\r
412 % ls >file1 >file2 >file3
\r
413 % less <file1 <file2
\r
419 % precmd () { RPROMPT="%(?..:()%" }
\r
420 % xpdf =(zcat /usr/share/doc/grml-docs/zsh/grml-zsh-refcard.pdf.gz)
\r
421 % w3m http://www.bash2zsh.com/zsh_refcard/refcard.pdf
\r
422 % man zsh-lovers</tt></pre>
\r
425 <h2>Ressources</h2>
\r
426 <div class="sectionbody">
\r
427 <div class="admonitionblock">
\r
430 <div class="title">Tip</div>
\r
432 <td class="content">run <em>zsh-help</em> on your grml system to get some hints regarding zsh</td>
\r
438 <a href="http://grml.org/zsh/">grml's zsh webpage</a>
\r
443 <a href="http://www.bash2zsh.com/">Book: From Bash to Z Shell: Conquering the Command Line</a>
\r
448 <h2>About this document</h2>
\r
449 <div class="sectionbody">
\r
450 <p>(c) Michael Prokop <mika@grml.org>; HTML version powered by <a href="http://www.methods.co.nz/asciidoc/">asciidoc</a>.</p>
\r
453 <div id="footer-text">
\r
454 Last updated 28-Nov-2006 10:14:56 CEST
\r