Update grmlzshrc.html + grml-zsh-refcard.pdf to latest repos versions
[grml.org.git] / zsh / grmlzshrc.html
1 <?xml version="1.0"
2 ?>
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <title>GRMLZSHRC</title>
7 <meta name="generator" content="http://txt2tags.org" />
8 <link rel="stylesheet" type="text/css" href="t2t-modern.css" />
9 </head>
10 <body>
11 <div class="header" id="header">
12 <h1>GRMLZSHRC</h1>
13 <h3>September, 2014</h3>
14 </div>
15 <div class="body" id="body">
16 <h1>NAME</h1>
17 <p>
18 grmlzshrc - Grml's zsh setup
19 </p>
20 <h1>SYNOPSIS</h1>
21 <p>
22 <i>zsh</i> [<b>options</b>]...
23 </p>
24 <h1>DESCRIPTION</h1>
25 <p>
26 The Grml project provides a fairly exhaustive interactive setup (referred to
27 as <i>grmlzshrc</i> throughout this document) for the amazing unix shell zsh
28 (<a href="http://zsh.sourceforge.net">http://zsh.sourceforge.net</a>). This is the reference manual for that
29 setup.
30 </p>
31 <p>
32 To use <i>grmlzshrc</i>, you need at least version 3.1.7 of zsh (although not all
33 features are enabled in every version).
34 </p>
35 <p>
36 <i>grmlzshrc</i> behaves differently depending on which user loads it. For the
37 root user (<b>EUID</b> == 0) only a subset of features is loaded by default. This
38 behaviour can be altered by setting the <b>GRML_ALWAYS_LOAD_ALL</b> STARTUP
39 VARIABLE (see below).
40 </p>
41 <p>
42 Users may want to keep an up-to-date version of the setup (possibly from the
43 git-sources) in <i>~/.zshrc</i>. If that happens on a system where the global
44 zshrc is also a <i>grmlzshrc</i> (but possibly an older one), you can inhibit
45 loading the global version by doing:
46
47 </p>
48 <pre>
49 echo setopt no_global_rcs &gt;&gt; ~/.zshenv
50 </pre>
51 <p>
52 Note, that this will disable <i>ANY</i> global files, except for the global
53 zshenv file.
54 </p>
55 <h1>STARTUP VARIABLES</h1>
56 <p>
57 Some of the behaviour of <i>grmlzshrc</i> can be altered by setting certain shell
58 variables. These may be set temporarily when starting zsh like this:
59
60 </p>
61 <pre>
62 % GRML_DISPLAY_BATTERY=1 zsh
63 </pre>
64 <p>
65 Or by setting them permanently in <b>zshrc.pre</b> (See AUXILIARY FILES below).
66 </p>
67 <dl>
68 <dt><b>BATTERY</b></dt><dd>
69 Deprecated. Use <b>GRML_DISPLAY_BATTERY</b> instead.
70 <p></p>
71 </dd>
72 <dt><b>COMMAND_NOT_FOUND</b></dt><dd>
73 A non zero value activates a handler, which is called when a command can not
74 be found. The handler is defined by GRML_ZSH_CNF_HANDLER (see below).
75 <p></p>
76 </dd>
77 <dt><b>GRML_COMP_CACHING</b></dt><dd>
78 If set to <i>yes</i> (the default), the setup will enable zsh's completion caching
79 mechanism, with the caching data being placed into <i>$GRML_COMP_CACHE_DIR</i>.
80 <p></p>
81 </dd>
82 <dt><b>GRML_COMP_CACHE_DIR</b></dt><dd>
83 This defines where zsh's completion caching data will be placed, if
84 <i>$GRML_COMP_CACHING</i> is active. The default is <i>${ZDOTDIR:-$HOME}/.cache</i>.
85 The setup will ensure the directory exists before attempting to use it.
86 <p></p>
87 </dd>
88 <dt><b>GRML_DISPLAY_BATTERY</b></dt><dd>
89 If set to a value greater than zero, <i>grmlzshrc</i> will put the battery status
90 into the right hand side interactive prompt. Supported OSes are <i>GNU/Linux</i>,
91 <i>FreeBSD</i>, <i>OpenBSD</i> and <i>Darwin</i>.
92 <p></p>
93 </dd>
94 <dt><b>GRML_ZSH_CNF_HANDLER</b></dt><dd>
95 This variable contains the handler to be used by COMMAND_NOT_FOUND (see above)
96 and defaults to "/usr/share/command-not-found/command-not-found".
97 <p></p>
98 </dd>
99 <dt><b>GRMLSMALL_SPECIFIC</b></dt><dd>
100 Set this to zero to remove items in zsh config, which do not work in
101 grml-small.
102 <p></p>
103 </dd>
104 <dt><b>HISTFILE</b></dt><dd>
105 Where zsh saves the history. Default: ${HOME}/.zsh_history.
106 <p></p>
107 </dd>
108 <dt><b>HISTSIZE</b></dt><dd>
109 Number of commands to be kept in the history. On a Grml-CD this defaults to
110 500, on a hard disk installation to 5000.
111 <p></p>
112 </dd>
113 <dt><b>MAILCHECK</b></dt><dd>
114 Sets the frequency in seconds for zsh to check for new mail. Defaults to 30.
115 A value of zero turns off checking.
116 <p></p>
117 </dd>
118 <dt><b>NOCOR</b></dt><dd>
119 Non zero values deactivate automatic correction of commands.
120 <p></p>
121 </dd>
122 <dt><b>NOMENU</b></dt><dd>
123 If set to zero (default), allows selection from a menu, if there are at least
124 five possible options of completion.
125 <p></p>
126 </dd>
127 <dt><b>NOPRECMD</b></dt><dd>
128 A non zero value disables precmd and preexec commands. These are functions
129 that are run before every command (setting xterm/screen titles etc.).
130 <p></p>
131 </dd>
132 <dt><b>REPORTTIME</b></dt><dd>
133 Show time (user, system and cpu) used by external commands, if they run longer
134 than the defined number of seconds (default: 5).
135 <p></p>
136 </dd>
137 <dt><b>SAVEHIST</b></dt><dd>
138 Number of commands to be stored in ${HISTFILE}. Defaults to 1000 on a Grml-CD
139 and to 10000 on an installation on hard disk.
140 <p></p>
141 </dd>
142 <dt><b>watch</b></dt><dd>
143 As in tcsh(1) an array of login/logout events to be reported by the shell
144 builtin "log". For details see zshparam(1). Defaults to (notme root).
145 <p></p>
146 </dd>
147 <dt><b>ZSH_NO_DEFAULT_LOCALE</b></dt><dd>
148 Import "/etc/default/locale", if set to zero (default).
149 <p></p>
150 </dd>
151 <dt><b>ZSH_PROFILE_RC</b></dt><dd>
152 A non zero value causes shell functions to be profiled. The results can be
153 obtained with the zprof builtin command (see zshmodules(1) for details).
154 <p></p>
155 </dd>
156 <dt><b>COMPDUMPFILE</b></dt><dd>
157 Specifies the location of the completion dump file. Default: $HOME/.zcompdump.
158 </dd>
159 </dl>
160 <h1>FEATURE DESCRIPTION</h1>
161 <p>
162 This is an in depth description of non-standard features implemented by
163 <i>grmlzshrc</i>.
164 </p>
165 <h2>DIRSTACK HANDLING</h2>
166 <p>
167 The dirstack in <i>grmlzshrc</i> has a persistent nature. It is stored into a
168 file each time zsh's working directory is changed. That file can be configured
169 via the <b>DIRSTACKFILE</b> variable and it defaults to <b>~/.zdirs</b>. The
170 <b>DIRSTACKSIZE</b> variable defaults to <b>20</b> in this setup.
171 </p>
172 <p>
173 The <b>DIRSTACKFILE</b> is loaded each time zsh starts, therefore freshly started
174 zshs inherit the dirstack of the zsh that most recently updated
175 <b>DIRSTACKFILE</b>.
176 </p>
177 <p>
178 It is possible to apply a filter to the names of directories that will be
179 committed to the persistent dirstack file. There are two ways to configure this
180 filter: A general function based filter and a pattern based filter. Both are
181 setup via styles in the <b>':grml:chpwd:dirstack'</b> context.
182 </p>
183 <p>
184 To use a function based filter set the <i>filter</i> style for that context to the
185 name of a function to call every time a directory name is to be added to the
186 persistent dirstack. If the function's return value signals success (ie. return
187 value "0"), the directory name is filtered out and <b>not</b> added to the
188 persistent stack. Example:
189
190 </p>
191 <pre>
192 function my_dirstack_filter() { [[ $1 == /tmp(|/*) ]] }
193 zstyle ':grml:chpwd:dirstack' filter my_dirstack_filter
194 </pre>
195 <p>
196 The pattern based filter uses a list of patterns passed to the <i>exclude</i>
197 style in the aforementioned context. Each pattern is tested and the first that
198 matches will keep the directory name from being added to the persistent stack.
199 If none of the patterns matches, the name is added. example:
200
201 </p>
202 <pre>
203 zstyle ':grml:chpwd:dirstack' exclude "/tmp(|/*)" "$HOME/tmp(|/*)"
204 </pre>
205 <p>
206 The function based filter is more general, the pattern based filter easier to
207 set up. If both filter variants are used at the same time, the function based
208 filter will be executed <i>before</i> the pattern based one.
209 </p>
210 <p>
211 If you would like to apply your filters while <i>loading</i> the persistent
212 dirstack file, set the <i>filter-on-load</i> boolean style (the default is
213 <i>false</i>):
214
215 </p>
216 <pre>
217 zstyle ':grml:chpwd:dirstack' filter-on-load true
218 </pre>
219 <p>
220 Setting the <i>filter-on-load</i> needs to be done in ".zshrc.pre" because the
221 style needs to be set when the main setup is executing! The other styles do not
222 have this limitation, but the initial filtering will obviously be done using
223 the filters that are configured <b>at</b> <b>that</b> <b>point</b>. The rule of thumb
224 is: If you want to filter on load, setup everything in ".zshrc.pre" otherwise
225 ".zshrc.local" works just as well.
226 </p>
227 <h2>DIRECTORY BASED PROFILES</h2>
228 <p>
229 If you need to perform certain actions each time you enter certain
230 directory-trees, this is the feature you are looking for.
231 </p>
232 <h3>Initialisation</h3>
233 <p>
234 To initialise the system, you need to call the function `chpwd_profiles' at
235 some point in your `zshrc.local'; preferably <b>after</b> you configured the
236 system. The configuration of the system is described further below.
237 </p>
238 <p>
239 If you need to do initialisations the first time `chpwd_profiles' is called
240 (which should be in your configuration file), you can do that in a function
241 called "chpwd_profiles_init". That function needs to be defined <b>before</b>
242 `chpwd_profiles' is called for this to work.
243 </p>
244 <p>
245 During the <b>first</b> call of `chpwd_profiles' (and therefore all its profile
246 functions) the parameter `$CHPWD_PROFILES_INIT' exists and is set to `1'. In
247 all other cases, the parameter does not exist at all.
248 </p>
249 <h3>Styles and Profile-names</h3>
250 <p>
251 To store its configuration, the system uses <b>functions</b> and <b>styles</b>
252 (zsh's context sensitive configuration system), such as this:
253 </p>
254 <p>
255
256 </p>
257 <pre>
258 zstyle ':chpwd:profiles:/usr/src/grml(|/|/*)'   profile grml
259 zstyle ':chpwd:profiles:/usr/src/debian(|/|/*)' profile debian
260 </pre>
261 <p>
262 When that's done and you enter a directory that matches the pattern in the
263 third part of the context, a function called chpwd_profile_grml, for example,
264 is called (if it exists).
265 </p>
266 <p>
267 If no pattern matches (read: no profile is detected) the profile is set to
268 'default', which means chpwd_profile_default is attempted to be called.
269 </p>
270 <p>
271 A word about the context (the ':chpwd:profiles:*' stuff in the zstyle command)
272 which is used: The third part in the context is matched against ${PWD}. That's
273 why using a pattern such as /foo/bar(|/|/*) makes sense. Because that way the
274 profile is detected for all these values of ${PWD}:
275
276 </p>
277 <pre>
278   /foo/bar
279   /foo/bar/
280   /foo/bar/baz
281 </pre>
282 <p>
283 So, if you want to make double damn sure a profile works in /foo/bar and
284 everywhere deeper in that tree, just use (|/|/*) and be happy.
285 </p>
286 <p>
287 The name of the detected profile will be available in a variable called
288 'profile' in your functions. You don't need to do anything, it'll just be
289 there.
290 </p>
291 <h3>Controlling Profile Execution</h3>
292 <p>
293 During its initialisation run, the system creates a parameter $CHPWD_PROFILE,
294 which is set to the profile that was is currently active (the default value is
295 "default"). That way you can avoid running code for a profile that is already
296 active, by running code such as the following at the start of your function:
297
298 </p>
299 <pre>
300 function chpwd_profile_grml() {
301     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
302   ...
303 }
304 </pre>
305 <p>
306 If you know you are going to do that all the time for each and every
307 directory-profile function you are ever going to write, you may also set the
308 `re-execute' style to `false' (which only defaults to `true' for backwards
309 compatibility), like this:
310
311 </p>
312 <pre>
313   zstyle ':chpwd:profiles:*' re-execute false
314 </pre>
315 <h3>Signaling availabily/profile changes</h3>
316 <p>
317 If you use this feature and need to know whether it is active in your current
318 shell, there are several ways to do that. Here are two simple ways:
319 </p>
320 <p>
321 a) If knowing if the profiles feature is active when zsh starts is good
322 enough for you, you can use the following snippet:
323 </p>
324 <p>
325 (( ${+functions[chpwd_profiles]} )) &amp;&amp; print "directory profiles active"
326 </p>
327 <p>
328 b) If that is not good enough, and you would prefer to be notified whenever a
329 profile changes, you can solve that by making sure you start <b>every</b>
330 profile function you create like this:
331 </p>
332 <p>
333 function chpwd_profile_myprofilename() {
334     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
335     print "chpwd(): Switching to profile: $profile"
336   ...
337 }
338 </p>
339 <p>
340 That makes sure you only get notified if a profile is <b>changed</b>, not
341 everytime you change directory. (To avoid this, you may also set the newer
342 `re-execute' style like described further above instead of the test on top of
343 the function.
344 </p>
345 <h3>Leaving Profiles</h3>
346 <p>
347 When the system switches from one profile to another, it executes a function
348 named "chpwd_leave_profile_&lt;PREVIOUS-PROFILE-NAME&gt;()" before calling the
349 profile-function for the new profile.
350 </p>
351 <h3>Version requirement</h3>
352 <p>
353 This feature requires zsh <i>4.3.3</i> or newer.
354 </p>
355 <h2>ACCEPTLINE WRAPPER</h2>
356 <p>
357 The <i>accept-line</i> wiget is the one that is taking action when the <b>return</b>
358 key is hit. <i>grmlzshrc</i> uses a wrapper around that widget, which adds new
359 functionality.
360 </p>
361 <p>
362 This wrapper is configured via styles. That means, you issue commands, that look
363 like:
364
365 </p>
366 <pre>
367 zstyle 'context' style value
368 </pre>
369 <p>
370 The context namespace, that we are using is 'acceptline'. That means, the actual
371 context for your commands look like: <b>':acceptline:&lt;subcontext&gt;'</b>.
372 </p>
373 <p>
374 Where <b>&lt;subcontext&gt;</b> is one of: <b>default</b>, <b>normal</b>, <b>force</b>, <b>misc</b>
375 or <b>empty</b>.
376 </p>
377 <h3>Recognized Contexts</h3>
378 <dl>
379 <dt><b>default</b></dt><dd>
380 This is the value, the context is initialized with.
381 The <i>compwarnfmt and //rehash</i> styles are looked up in this context.
382 <p></p>
383 </dd>
384 <dt><b>normal</b></dt><dd>
385 If the first word in the command line is either a command, alias, function,
386 builtin or reserved word, you are in this context.
387 <p></p>
388 </dd>
389 <dt><b>force</b></dt><dd>
390 This is the context, that is used if you hit enter again, after being warned
391 about the existence of a _completion for the non-existing command you
392 entered.
393 <p></p>
394 </dd>
395 <dt><b>empty</b></dt><dd>
396 This is the context, you are in if the command line is empty or only
397 consists of whitespace.
398 <p></p>
399 </dd>
400 <dt><b>misc</b></dt><dd>
401 This context is in effect, if you entered something that does not match any
402 of the above. (e.g.: variable assignments).
403 </dd>
404 </dl>
405 <h3>Available Styles</h3>
406 <dl>
407 <dt><b>nocompwarn</b></dt><dd>
408 If you set this style to true, the warning about non existent commands,
409 for which completions exist will not be issued. (Default: <b>false</b>)
410 <p></p>
411 </dd>
412 <dt><b>compwarnfmt</b></dt><dd>
413 The message, that is displayed to warn about the _completion issue.
414 (default: <b>'%c will not execute and completion %f exists.'</b>)
415 '%c' is replaced by the command name, '%f' by the completion's name.
416 <p></p>
417 </dd>
418 <dt><b>rehash</b></dt><dd>
419 If this is set, we'll force rehashing, if appropriate. (Defaults to
420 <b>true</b> in <i>grmlzshrc</i>).
421 <p></p>
422 </dd>
423 <dt><b>actions</b></dt><dd>
424 This can be a list of wigdets to call in a given context. If you need a
425 specific order for these to be called, name them accordingly. The default value
426 is an <b>empty list</b>.
427 <p></p>
428 </dd>
429 <dt><b>default_action</b></dt><dd>
430 The name of a widget, that is called after the widgets from 'actions'.
431 By default, this will be '.accept-line' (which is the built-in accept-line
432 widget).
433 <p></p>
434 </dd>
435 <dt><b>call_default</b></dt><dd>
436 If true in the current context, call the widget in the 'default_action'
437 style. (The default is <b>true</b> in all contexts.)
438 </dd>
439 </dl>
440 <h2>PROMPT</h2>
441 <p>
442 The <i>grmlzshrc</i> now supplies three prompt themes compatible with zsh's
443 <b>promptinit</b> system. The three themes are called <b>grml</b>, <b>grml-large</b> and
444 <b>grml-chroot</b>.
445 </p>
446 <p>
447 By default, <b>grml</b> is used, unless <i>$GRMLPROMPT</i> is set to a value larger
448 than zero, in which case <b>grml-large</b> is used. Lastly, if <i>$GRML_CHROOT</i> is
449 non-empty, <b>grml-chroot</b> is used.
450 </p>
451 <p>
452 As usual, with promtinit themes, the user may switch to a different theme using
453 the <i>prompt</i> utility:
454
455 </p>
456 <pre>
457     prompt grml-large
458 </pre>
459 <p>
460 That will use the <b>grml-large</b> prompt theme.
461 </p>
462 <p>
463 The themes are highly customisable. The main source of documentation about
464 customisation is the main <b>grml</b> theme's doc-string, that is available via
465 the following command:
466
467 </p>
468 <pre>
469     prompt -h grml
470 </pre>
471 <p>
472 The other themes also come with doc-strings, but the main theme's is the
473 canonical reference about all of them.
474 </p>
475 <p>
476 This feature requires version <i>4.3.7</i> of the shell. Older versions will use
477 the classic grml prompt as a fallback.
478 </p>
479 <p>
480 A note to people who like customisation: If you are <b>not</b> using a prompt
481 theme for your customisation, but you're either statically setting $PS1 (or
482 $PROMPT) or you're constructing one of those variables in zsh's \`precmd()'
483 function, make sure you are turning the zsh's prompt theme system <b>off</b>
484 before doing so. A correct example customisation could look like this:
485
486 </p>
487 <pre>
488     # Turn the prompt system off:
489     prompt off
490     # Customise the prompt yourself:
491     PS1='%~ %# '
492 </pre>
493 <p>
494 You also add your own tokens by using the \`grml_theme_add_token()' function.
495 Call the function without arguments for detailed documentation about that
496 procedure.
497 </p>
498 <h2>GNU/SCREEN STATUS SETTING</h2>
499 <p>
500 <i>grmlzshrc</i> sets screen's hardstatus lines to the currently running command
501 or <b>'zsh'</b> if the shell is idling at its prompt. If the current working
502 directory is inside a repository unter version control, screen status is set
503 to: <b>'zsh: &lt;repository name&gt;'</b> via zsh's vcs_info.
504 </p>
505 <h2>PERSISTENT HISTORY</h2>
506 <p>
507 If you got commands you consider important enough to be included in every
508 shell's history, you can put them into ~/.important_commands and they will be
509 available via the usual history lookup widgets.
510 </p>
511 <h1>REFERENCE</h1>
512 <h2>ENVIRONMENT VARIABLES</h2>
513 <p>
514 <i>grmlzshrc</i> sets some environment variables, which influence the
515 behaviour of applications.
516 </p>
517 <dl>
518 <dt><b>COLORTERM</b></dt><dd>
519 Set to "yes". Some applications read this to learn about properties
520 of the terminal they are running in.
521 <p></p>
522 </dd>
523 <dt><b>EDITOR</b></dt><dd>
524 If not already set, sets the default editor. Falls back to vi(1),
525 if vim(1) is not available.
526 <p></p>
527 </dd>
528 <dt><b>LESS_TERMCAP_*</b></dt><dd>
529 Some environment variables that add colour support to less(1) for viewing
530 man pages. See termcap(5) for details.
531 <p></p>
532 </dd>
533 <dt><b>MAIL</b></dt><dd>
534 The mailbox file for the current user is set to /var/mail/$USER, if not
535 already set otherwise.
536 <p></p>
537 </dd>
538 <dt><b>PAGER</b></dt><dd>
539 Set less(1) as default pager, if not already set to something different.
540 </dd>
541 </dl>
542 <h2>OPTIONS</h2>
543 <p>
544 Apart from zsh's default options, <i>grmlzshrc</i> sets some options
545 that change the behaviour of zsh. Options that change Z-shell's default
546 settings are marked by &lt;grml&gt;. But note, that zsh's defaults vary depending
547 on its emulation mode (csh, ksh, sh, or zsh). For details, see zshoptions(1).
548 </p>
549 <dl>
550 <dt><b>append_history</b></dt><dd>
551 Zsh sessions, that use <i>grmlzshrc</i>, will append their history list to the
552 history file, rather than replace it. Thus, multiple parallel zsh sessions
553 will all have the new entries from their history lists added to the history
554 file, in the order that they exit. The file will still be periodically
555 re-written to trim it when the number of lines grows 20% beyond the value
556 specified by $SAVEHIST.
557 <p></p>
558 </dd>
559 <dt><b>auto_cd</b> &lt;grml&gt;</dt><dd>
560 If a command is issued that can't be executed as a normal command, and the
561 command is the name of a directory, perform the cd command to that directory.
562 <p></p>
563 </dd>
564 <dt><b>auto_pushd</b> &lt;grml&gt;</dt><dd>
565 Make cd push the old directory onto the directory stack.
566 <p></p>
567 </dd>
568 <dt><b>completeinword</b> &lt;grml&gt;</dt><dd>
569 If the cursor is inside a word, completion is done from both ends;
570 instead of moving the cursor to the end of the word first and starting
571 from there.
572 <p></p>
573 </dd>
574 <dt><b>extended_glob</b> &lt;grml&gt;</dt><dd>
575 Treat the '#', '~' and '^' characters as active globbing pattern characters.
576 <p></p>
577 </dd>
578 <dt><b>extended_history</b> &lt;grml&gt;</dt><dd>
579 Save each command's beginning timestamp (in seconds since the epoch) and the
580 duration (in seconds) to the history file.
581 <p></p>
582 </dd>
583 <dt><b>hash_list_all</b></dt><dd>
584 Whenever a command completion is attempted, make sure the entire command
585 path is hashed first. This makes the first completion slower.
586 <p></p>
587 </dd>
588 <dt><b>histignorealldups</b> &lt;grml&gt;</dt><dd>
589 If a new command line being added to the history list duplicates an
590 older one, the older command is removed from the list, even if it is
591 not the previous event.
592 <p></p>
593 </dd>
594 <dt><b>histignorespace</b> &lt;grml&gt;</dt><dd>
595 Remove command lines from the history list when the first character on
596 the line is a space, or when one of the expanded aliases contains a
597 leading space. Note that the command lingers in the internal history
598 until the next command is entered before it vanishes.
599 <p></p>
600 </dd>
601 <dt><b>longlistjobs</b> &lt;grml&gt;</dt><dd>
602 List jobs in long format by default.
603 <p></p>
604 </dd>
605 <dt><b>nobeep</b> &lt;grml&gt;</dt><dd>
606 Avoid to beep on errors in zsh command line editing (zle).
607 <p></p>
608 </dd>
609 <dt><b>noglobdots</b></dt><dd>
610 A wildcard character never matches a leading '.'.
611 <p></p>
612 </dd>
613 <dt><b>nohup</b> &lt;grml&gt;</dt><dd>
614 Do not send the hangup signal (HUP:1) to running jobs when the shell exits.
615 <p></p>
616 </dd>
617 <dt><b>nonomatch</b> &lt;grml&gt;</dt><dd>
618 If a pattern for filename generation has no matches, do not print an error
619 and leave it unchanged in the argument list. This also applies to file
620 expansion of an initial `~' or `='.
621 <p></p>
622 </dd>
623 <dt><b>notify</b></dt><dd>
624 Report the status of background jobs immediately, rather than waiting until
625 just before printing a prompt.
626 <p></p>
627 </dd>
628 <dt><b>pushd_ignore_dups</b> &lt;grml&gt;</dt><dd>
629 Don't push multiple copies of the same directory onto the directory stack.
630 <p></p>
631 </dd>
632 <dt><b>share_history</b> &lt;grml&gt;</dt><dd>
633 As each line is added to the history file, it is checked to see if anything
634 else was written out by another shell, and if so it is included in the
635 history of the current shell too. Using !-style history, the commands from
636 the other sessions will not appear in the history list unless you explicitly
637 type the "history" command. This option is activated for zsh versions &gt;= 4,
638 only.
639 </dd>
640 </dl>
641 <h2>KEYBINDINGS</h2>
642 <p>
643 Apart from zsh's default key bindings, <i>grmlzshrc</i> comes with its own set of
644 key bindings. Note that bindings like <b>ESC-e</b> can also be typed as <b>ALT-e</b>
645 on PC keyboards.
646 </p>
647 <dl>
648 <dt><b>ESC-e</b></dt><dd>
649 Edit the current command buffer in your favourite editor.
650 <p></p>
651 </dd>
652 <dt><b>ESC-v</b></dt><dd>
653 Deletes a word left of the cursor; seeing '/' as additional word separator.
654 <p></p>
655 </dd>
656 <dt><b>CTRL-x-1</b></dt><dd>
657 Jump right after the first word.
658 <p></p>
659 </dd>
660 <dt><b>CTRL-x-M()</b></dt><dd>
661 Create directory under cursor or the selected area.
662 To select an area press ctrl-@ and use the cursor.
663 Use case: you type "mv abc ~/testa/testb/testc/" and remember that the
664 directory does not exist yet -&gt; press <b>CTRL-xM</b> and problem solved.
665 <p></p>
666 </dd>
667 <dt><b>CTRL-x-p</b></dt><dd>
668 Searches the last occurence of string before the cursor in the command history.
669 <p></p>
670 </dd>
671 <dt><b>CTRL-x-z</b></dt><dd>
672 Display help on keybindings and zsh line editor. Press consecutively to page through content.
673 <p></p>
674 </dd>
675 <dt><b>CTRL-z</b></dt><dd>
676 Brings a job, which got suspended with CTRL-z back to foreground.
677 </dd>
678 </dl>
679 <h3>Customisation</h3>
680 <p>
681 To customise keybindings, you can just use zsh's bindkey utility. However, if
682 you plan to to use the `<i>zle-line-init</i>' or `<i>zle-line-finish</i>' hooks
683 yourself, make sure you call the following functions in the respective hook:
684 </p>
685 <ul>
686 <li><b>zle-line-init</b>: <i>zle-smkx</i>
687 </li>
688 <li><b>zle-line-finish</b>: <i>zle-rmkx</i>
689 </li>
690 </ul>
691 <p>
692 This is <b>required</b> so the keybindings set up by <i>grmlzshrc</i> work. The
693 reason for this is to turn the terminal into the right mode while zsh's line
694 editor (zle) is running. This enables us to query <i>terminfo</i> about escape
695 sequences for special keys and thus simplify and generalise our keybinding
696 section.
697 </p>
698 <h2>SHELL FUNCTIONS</h2>
699 <p>
700 <i>grmlzshrc</i> comes with a wide array of defined shell functions to ease the
701 user's life.
702 </p>
703 <dl>
704 <dt><b>855resolution()</b></dt><dd>
705 If 915resolution is available, issues a warning to the user to run it instead
706 to modify the resolution on intel graphics chipsets.
707 <p></p>
708 </dd>
709 <dt><b>accessed()</b></dt><dd>
710 Lists files in current directory, which have been accessed within the
711 last N days. N is an integer to be passed as first and only argument.
712 If no argument is specified N is set to 1.
713 <p></p>
714 </dd>
715 <dt><b>any()</b></dt><dd>
716 Lists processes matching given pattern.
717 <p></p>
718 </dd>
719 <dt><b>asc()</b></dt><dd>
720 Login on the host provided as argument using autossh. Then reattach a GNU screen
721 session if a detached session is around or detach a currently attached screen or
722 else start a new screen.  This is especially useful for roadwarriors using GNU
723 screen and ssh.
724 <p></p>
725 </dd>
726 <dt><b>bk()</b></dt><dd>
727 Simple backup management of a file or directory using standard unix programs.
728 The target file name is the original name plus a time stamp attached. Symlinks
729 and file attributes like mode, ownership and timestamps are preserved.
730 <p></p>
731 </dd>
732 <dt><b>cdrecord()</b></dt><dd>
733 If the original cdrecord is not installed, issues a warning to the user to
734 use the wodim binary instead. Wodim is the debian fork of Joerg Schillings
735 cdrecord.
736 <p></p>
737 </dd>
738 <dt><b>cdt()</b></dt><dd>
739 Creates a temporary directory using mktemp. Then changes current
740 working directory to it.
741 <p></p>
742 </dd>
743 <dt><b>changed()</b></dt><dd>
744 Lists files in current directory, which have been changed within the
745 last N days. N is an integer to be passed as first and only argument.
746 If no argument is specified N is set to 1.
747 <p></p>
748 </dd>
749 <dt><b>check_com()</b></dt><dd>
750 Returns true if given command exists either as program, function, alias,
751 builtin or reserved word. If the option -c is given, only returns true,
752 if command is a program.
753 <p></p>
754 </dd>
755 <dt><b>checkhome()</b></dt><dd>
756 Changes directory to $HOME on first invocation of zsh. This is necessary on
757 Grml systems with autologin.
758 <p></p>
759 </dd>
760 <dt><b>cl()</b></dt><dd>
761 Changes current directory to the one supplied by argument and lists the files
762 in it, including file names starting with ".".
763 <p></p>
764 </dd>
765 <dt><b>dchange()</b></dt><dd>
766 Shows the changelog of given package in $PAGER.
767 <p></p>
768 </dd>
769 <dt><b>dcopyright()</b></dt><dd>
770 Shows the copyright of given package in $PAGER.
771 <p></p>
772 </dd>
773 <dt><b>debian2hd()</b></dt><dd>
774 Tells the user to use grml-debootstrap, if she wants to install debian to
775 harddisk.
776 <p></p>
777 </dd>
778 <dt><b>deswap()</b></dt><dd>
779 A trick from $LINUX-KERNELSOURCE/Documentation/power/swsusp.txt. It brings
780 back interactive responsiveness after suspend, when the system is swapping
781 heavily.
782 <p></p>
783 </dd>
784 <dt><b>dnews()</b></dt><dd>
785 Shows the NEWS file for the given package in $PAGER.
786 <p></p>
787 </dd>
788 <dt><b>edalias()</b></dt><dd>
789 Edit given alias.
790 <p></p>
791 </dd>
792 <dt><b>edfunc()</b></dt><dd>
793 Edit given shell function.
794 <p></p>
795 </dd>
796 <dt><b>freload()</b></dt><dd>
797 Reloads an autoloadable shell function (See autoload in zshbuiltins(1)).
798 <p></p>
799 </dd>
800 <dt><b>grml_vcs_info_toggle_colour()</b></dt><dd>
801 Toggles between coloured and uncoloured formats in vcs_info configuration.
802 This is useful with prompts that break if colour codes are in vcs_info
803 format expansions (like the `clint' prompt and every other prompt that
804 uses %v to expand the contents of `$vcs_into_msg_0_'). If you are using
805 customised vcs_info formats, you shouldn't be using this function, since
806 it will set all formats to grml's default values (either coloured or plain)
807 again.
808 <p></p>
809 </dd>
810 <dt><b>hgdi()</b></dt><dd>
811 Use GNU diff with options -ubwd for mercurial.
812 <p></p>
813 </dd>
814 <dt><b>hgstat()</b></dt><dd>
815 Displays diffstat between the revision given as argument and tip (no
816 argument means last revision).
817 <p></p>
818 </dd>
819 <dt><b>hidiff()</b></dt><dd>
820 Outputs highlighted diff; needs highstring(1).
821 <p></p>
822 </dd>
823 <dt><b>is4()</b></dt><dd>
824 Returns true, if zsh version is equal or greater than 4, else false.
825 <p></p>
826 </dd>
827 <dt><b>is41()</b></dt><dd>
828 Returns true, if zsh version is equal or greater than 4.1, else false.
829 <p></p>
830 </dd>
831 <dt><b>is42()</b></dt><dd>
832 Returns true, if zsh version is equal or greater than 4.2, else false.
833 <p></p>
834 </dd>
835 <dt><b>is425()</b></dt><dd>
836 Returns true, if zsh version is equal or greater than 4.2.5, else false.
837 <p></p>
838 </dd>
839 <dt><b>is43()</b></dt><dd>
840 Returns true, if zsh version is equal or greater than 4.3, else false.
841 <p></p>
842 </dd>
843 <dt><b>is433()</b></dt><dd>
844 Returns true, if zsh version is equal or greater than 4.3.3, else false.
845 <p></p>
846 </dd>
847 <dt><b>isdarwin()</b></dt><dd>
848 Returns true, if running on darwin, else false.
849 <p></p>
850 </dd>
851 <dt><b>isfreebsd()</b></dt><dd>
852 Returns true, if running on FreeBSD, else false.
853 <p></p>
854 </dd>
855 <dt><b>isgrml()</b></dt><dd>
856 Returns true, if running on a grml system, else false.
857 <p></p>
858 </dd>
859 <dt><b>isgrmlcd()</b></dt><dd>
860 Returns true, if running on a grml system from a live cd, else false.
861 <p></p>
862 </dd>
863 <dt><b>isgrmlsmall()</b></dt><dd>
864 Returns true, if run on grml-small, else false.
865 <p></p>
866 </dd>
867 <dt><b>islinux()</b></dt><dd>
868 Returns true, if running on Linux, else false.
869 <p></p>
870 </dd>
871 <dt><b>iso2utf()</b></dt><dd>
872 Changes every occurrence of the string iso885915 or ISO885915 in
873 environment variables to UTF-8.
874 <p></p>
875 </dd>
876 <dt><b>isopenbsd()</b></dt><dd>
877 Returns true, if running on OpenBSD, else false.
878 <p></p>
879 </dd>
880 <dt><b>isutfenv()</b></dt><dd>
881 Returns true, if run within an utf environment, else false.
882 <p></p>
883 </dd>
884 <dt><b>mkcd()</b></dt><dd>
885 Creates directory including parent directories, if necessary. Then changes
886 current working directory to it.
887 <p></p>
888 </dd>
889 <dt><b>modified()</b></dt><dd>
890 Lists files in current directory, which have been modified within the
891 last N days. N is an integer to be passed as first and only argument.
892 If no argument is specified N is set to 1.
893 <p></p>
894 </dd>
895 <dt><b>nt()</b></dt><dd>
896 A helper function for the "e" glob qualifier to list all files newer
897 than a reference file.
898
899 Example usages:
900 <pre>
901 % NTREF=/reference/file
902 % ls -l *(e:nt:)
903 % # Inline:
904 % ls -l *(e:'nt /reference/file':)
905 </pre>
906 <p></p>
907 </dd>
908 <dt><b>profile()</b></dt><dd>
909 Runs a command in zsh with profiling enabled (See startup variable
910 ZSH_PROFILE_RC above).
911 <p></p>
912 </dd>
913 <dt><b>salias()</b></dt><dd>
914 Creates an alias whith sudo prepended, if $EUID is not zero. Run "salias -h"
915 for details. See also xunfunction() below.
916 <p></p>
917 </dd>
918 <dt><b>simple-extract()</b></dt><dd>
919 Tries to uncompress/unpack given files with the appropriate programs. If an URI
920 starting with https, http or ftp is provided simple-extract tries to download
921 and then uncompress/unpack the file. The choice is made along the filename
922 ending. simple-extract will not delete the original archive (even on .gz,.bz2 or
923 .xz) unless you use the '-d' option.
924 <p></p>
925 </dd>
926 <dt><b>sll()</b></dt><dd>
927 Prints details of symlinks given as arguments.
928 <p></p>
929 </dd>
930 <dt><b>ssl-cert-fingerprints</b></dt><dd>
931 Prints the SHA512, SHA256, SHA1 and MD5 digest of a x509 certificate.
932 First and only parameter must be a file containing a certificate. Use
933 /dev/stdin as file if you want to pipe a certificate to these
934 functions.
935 <p></p>
936 </dd>
937 <dt><b>ssl-cert-info</b></dt><dd>
938 Prints all information of a x509 certificate including the SHA512,
939 SHA256, SHA1 and MD5 digests. First and only parameter must be a file
940 containing a certificate. Use /dev/stdin as file if you want to pipe a
941 certificate to this function.
942 <p></p>
943 </dd>
944 <dt><b>ssl-cert-sha512(), ssl-cert-sha256(), ssl-cert-sha1(), ssl-cert-md5()</b></dt><dd>
945 Prints the SHA512, SHA256, SHA1 respective MD5 digest of a x509
946 certificate. First and only parameter must be a file containing a
947 certificate. Use /dev/stdin as file if you want to pipe a certificate
948 to this function.
949 <p></p>
950 </dd>
951 <dt><b>Start(), Restart(), Stop(), Force-Reload(), Reload()</b></dt><dd>
952 Functions for controlling daemons.
953 <pre>
954 Example usage:
955 % Restart ssh
956 </pre>
957 <p></p>
958 </dd>
959 <dt><b>trans()</b></dt><dd>
960 Translates a word from german to english (-D) or vice versa (-E).
961 <p></p>
962 </dd>
963 <dt><b>uchange()</b></dt><dd>
964 Shows upstreams changelog of a given package in $PAGER.
965 <p></p>
966 </dd>
967 <dt><b>uprint()</b></dt><dd>
968 Works around the "print -l ${(u)foo}"-limitation on zsh older than 4.2.
969 <p></p>
970 </dd>
971 <dt><b>utf2iso()</b></dt><dd>
972 Changes every occurrence of the string UTF-8 or utf-8 in environment
973 variables to iso885915.
974 <p></p>
975 </dd>
976 <dt><b>vim()</b></dt><dd>
977 Wrapper for vim(1). It tries to set the title and hands vim the environment
978 variable VIM_OPTIONS on the command line. So the user may define command
979 line options, she always wants, in her .zshrc.local.
980 <p></p>
981 </dd>
982 <dt><b>whatwhen()</b></dt><dd>
983 Searches the history for a given pattern and lists the results by date.
984 The first argument is the search pattern. The second and third ones are
985 optional and denote a search range (default: -100).
986 <p></p>
987 </dd>
988 <dt><b>xcat()</b></dt><dd>
989 Tries to cat(1) file(s) given as parameter(s). Always returns true.
990 See also xunfunction() below.
991 <p></p>
992 </dd>
993 <dt><b>xsource()</b></dt><dd>
994 Tries to source the file(s) given as parameter(s). Always returns true.
995 See zshbuiltins(1) for a detailed description of the source command.
996 See also xunfunction() below.
997 <p></p>
998 </dd>
999 <dt><b>xtrename()</b></dt><dd>
1000 Changes the title of xterm window from within screen(1). Run without
1001 arguments for details.
1002 <p></p>
1003 </dd>
1004 <dt><b>xunfunction()</b></dt><dd>
1005 Removes the functions salias, xcat, xsource, xunfunction and zrcautoload.
1006 <p></p>
1007 </dd>
1008 <dt><b>zrcautoload()</b></dt><dd>
1009 Wrapper around the autoload builtin. Loads the definitions of functions
1010 from the file given as argument. Searches $fpath for the file. See also
1011 xunfunction() above.
1012 <p></p>
1013 </dd>
1014 <dt><b>zrclocal()</b></dt><dd>
1015 Sources /etc/zsh/zshrc.local and ${HOME}/.zshrc.local. These are the files
1016 where own modifications should go. See also zshbuiltins(1) for a description
1017 of the source command.
1018 </dd>
1019 </dl>
1020 <h2>ALIASES</h2>
1021 <p>
1022 <i>grmlzshrc</i> comes with a wide array of predefined aliases to ease the user's
1023 life. A few aliases (like those involving <i>grep</i> or <i>ls</i>) use the option
1024 <i>--color=auto</i> for colourizing output. That option is part of <b>GNU</b>
1025 implementations of these tools, and will only be used if such an implementation
1026 is detected.
1027 </p>
1028 <dl>
1029 <dt><b>acp</b> (<i>apt-cache policy</i>)</dt><dd>
1030 With no arguments prints out the priorities of each source. If a package name
1031 is given, it displays detailed information about the priority selection of the
1032 package.
1033 <p></p>
1034 </dd>
1035 <dt><b>acs</b> (<i>apt-cache search</i>)</dt><dd>
1036 Searches debian package lists for the regular expression provided as argument.
1037 The search includes package names and descriptions. Prints out name and short
1038 description of matching packages.
1039 <p></p>
1040 </dd>
1041 <dt><b>acsh</b> (<i>apt-cache show</i>)</dt><dd>
1042 Shows the package records for the packages provided as arguments.
1043 <p></p>
1044 </dd>
1045 <dt><b>adg</b> (<i>apt-get dist-upgrade</i>)</dt><dd>
1046 Performs an upgrade of all installed packages. Also tries to automatically
1047 handle changing dependencies with new versions of packages. As this may change
1048 the install status of (or even remove) installed packages, it is potentially
1049 dangerous to use dist-upgrade; invoked by sudo, if necessary.
1050 <p></p>
1051 </dd>
1052 <dt><b>ag</b> (<i>apt-get upgrade</i>)</dt><dd>
1053 Downloads and installs the newest versions of all packages currently installed
1054 on the system. Under no circumstances are currently installed packages removed,
1055 or packages not already installed retrieved and installed. New versions of
1056 currently installed packages that cannot be upgraded without changing the install
1057 status of another package will be left at their current version. An update must
1058 be performed first (see au below); run by sudo, if necessary.
1059 <p></p>
1060 </dd>
1061 <dt><b>agi</b> (<i>apt-get install</i>)</dt><dd>
1062 Downloads and installs or upgrades the packages given on the command line.
1063 If a hyphen is appended to the package name, the identified package will be
1064 removed if it is installed. Similarly a plus sign can be used to designate a
1065 package to install. This may be useful to override decisions made by apt-get's
1066 conflict resolution system.
1067 A specific version of a package can be selected for installation by following
1068 the package name with an equals and the version of the package to select. This
1069 will cause that version to be located and selected for install. Alternatively a
1070 specific distribution can be selected by following the package name with a slash
1071 and the version of the distribution or the Archive name (stable, testing, unstable).
1072 Gets invoked by sudo, if user id is not 0.
1073 <p></p>
1074 </dd>
1075 <dt><b>ati</b> (<i>aptitude install</i>)</dt><dd>
1076 Aptitude is a terminal-based package manager with a command line mode similar to
1077 apt-get (see agi above); invoked by sudo, if necessary.
1078 <p></p>
1079 </dd>
1080 <dt><b>au</b> (<i>apt-get update</i>)</dt><dd>
1081 Resynchronizes the package index files from their sources. The indexes of
1082 available packages are fetched from the location(s) specified in
1083 /etc/apt/sources.list. An update should always be performed before an
1084 upgrade or dist-upgrade; run by sudo, if necessary.
1085 <p></p>
1086 </dd>
1087 <dt><b>da</b> (<i>du -sch</i>)</dt><dd>
1088 Prints the summarized disk usage of the arguments as well as a grand total
1089 in human readable format.
1090 <p></p>
1091 </dd>
1092 <dt><b>dbp</b> (<i>dpkg-buildpackage</i>)</dt><dd>
1093 Builds binary or source packages from sources (See: dpkg-buildpackage(1)).
1094 <p></p>
1095 </dd>
1096 <dt><b>debs-by-size</b> (<i>grep-status -FStatus -sInstalled-Size,Package -n "install ok installed" | paste -sd "  \n" | sort -rn</i>)</dt><dd>
1097 Prints installed Packages sorted by size (descending).
1098 <p></p>
1099 </dd>
1100 <dt><b>dir</b> (<i>ls -lSrah</i>)</dt><dd>
1101 Lists files (including dot files) sorted by size (biggest last) in long and
1102 human readable output format.
1103 <p></p>
1104 </dd>
1105 <dt><b>ge</b> (<i>grep-excuses</i>)</dt><dd>
1106 Searches the testing excuses files for a specific maintainer (See:
1107 grep-excuses(1)).
1108 <p></p>
1109 </dd>
1110 <dt><b>grep</b> (<i>grep --color=auto</i>)</dt><dd>
1111 Shows grep output in nice colors, if available.
1112 <p></p>
1113 </dd>
1114 <dt><b>grml-version</b> (<i>cat /etc/grml_version</i>)</dt><dd>
1115 Prints version of running grml.
1116 <p></p>
1117 </dd>
1118 <dt><b>hbp</b> (<i>hg-buildpackage</i>)</dt><dd>
1119 Helper program to maintain Debian packages with mercurial.
1120 <p></p>
1121 </dd>
1122 <dt><b>http</b> (<i>python -m SimpleHTTPServer</i>)</dt><dd>
1123 Basic HTTP server implemented in python. Listens on port 8000/tcp and
1124 serves current directory. Implements GET and HEAD methods.
1125 <p></p>
1126 </dd>
1127 <dt><b>insecscp</b> (<i>scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1128 scp with possible man-in-the-middle attack enabled. This is convenient, if the targets
1129 host key changes frequently, for example on virtualized test- or development-systems.
1130 To be used only inside trusted networks, of course.
1131 <p></p>
1132 </dd>
1133 <dt><b>insecssh</b> (<i>ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1134 ssh with possible man-in-the-middle attack enabled
1135 (for an explanation see insecscp above).
1136 <p></p>
1137 </dd>
1138 <dt><b>help-zshglob</b> (<i>H-Glob()</i>)</dt><dd>
1139 Runs the function H-Glob() to expand or explain wildcards.
1140 <p></p>
1141 </dd>
1142 <dt><b>j</b> (<i>jobs -l</i>)</dt><dd>
1143 Prints status of jobs in the current shell session in long format.
1144 <p></p>
1145 </dd>
1146 <dt><b>l</b> (<i>ls -l --color=auto</i>)</dt><dd>
1147 Lists files in long output format with indicator for filetype appended
1148 to filename. If the terminal supports it, with colored output.
1149 <p></p>
1150 </dd>
1151 <dt><b>la</b> (<i>ls -la --color=auto</i>)</dt><dd>
1152 Lists files in long colored output format. Including file names
1153 starting with ".".
1154 <p></p>
1155 </dd>
1156 <dt><b>lad</b> (<i>ls -d .*(/)</i>)</dt><dd>
1157 Lists the dot directories (not their contents) in current directory.
1158 <p></p>
1159 </dd>
1160 <dt><b>lh</b> (<i>ls -hAl --color=auto</i>)</dt><dd>
1161 Lists files in long and human readable output format in nice colors,
1162 if available. Includes file names starting with "." except "." and
1163 "..".
1164 <p></p>
1165 </dd>
1166 <dt><b>ll</b> (<i>ls -l --color=auto</i>)</dt><dd>
1167 Lists files in long colored output format.
1168 <p></p>
1169 </dd>
1170 <dt><b>llog</b> (<i>$PAGER /var/log/syslog</i>)</dt><dd>
1171 Opens syslog in pager.
1172 <p></p>
1173 </dd>
1174 <dt><b>ls</b> (<i>ls -C --color=auto</i>)</dt><dd>
1175 Lists directory, entries are listed by columns and an indicator for
1176 file type is appended to each file name. Additionally the output is
1177 colored, if the terminal supports it.
1178 <p></p>
1179 </dd>
1180 <dt><b>lsa</b> (<i>ls -a .*(.)</i>)</dt><dd>
1181 Lists dot files in current working directory.
1182 <p></p>
1183 </dd>
1184 <dt><b>lsbig</b> (<i>ls -flh *(.OL[1,10])</i>)</dt><dd>
1185 Displays the ten biggest files (long and human readable output format).
1186 <p></p>
1187 </dd>
1188 <dt><b>lsd</b> (<i>ls -d *(/)</i>)</dt><dd>
1189 Shows directories.
1190 <p></p>
1191 </dd>
1192 <dt><b>lse</b> (<i>ls -d *(/^F)</i>)</dt><dd>
1193 Shows empty directories.
1194 <p></p>
1195 </dd>
1196 <dt><b>lsl</b> (<i>ls -l *(@)</i>)</dt><dd>
1197 Lists symbolic links in current directory.
1198 <p></p>
1199 </dd>
1200 <dt><b>lsnew</b> (<i>ls -rl *(D.om[1,10])</i>)</dt><dd>
1201 Displays the ten newest files (long output format).
1202 <p></p>
1203 </dd>
1204 <dt><b>lsnewdir</b> (<i>ls -rthdl *(/om[1,10]) .*(D/om[1,10])</i>)</dt><dd>
1205 Displays the ten newest directories and ten newest .directories.
1206 <p></p>
1207 </dd>
1208 <dt><b>lsold</b> (<i>ls -rtlh *(D.om[1,10])</i>)</dt><dd>
1209 Displays the ten oldest files (long output format).
1210 <p></p>
1211 </dd>
1212 <dt><b>lsolddir</b> (<i>ls -rthdl *(/Om[1,10]) .*(D/Om[1,10])</i>)</dt><dd>
1213 Displays the ten oldest directories and ten oldest .directories.
1214 <p></p>
1215 </dd>
1216 <dt><b>lss</b> (<i>ls -l *(s,S,t)</i>)</dt><dd>
1217 Lists files in current directory that have the setuid, setgid or sticky bit
1218 set.
1219 <p></p>
1220 </dd>
1221 <dt><b>lssmall</b> (<i>ls -Srl *(.oL[1,10])</i>)</dt><dd>
1222 Displays the ten smallest files (long output format).
1223 <p></p>
1224 </dd>
1225 <dt><b>lsw</b> (<i>ls -ld *(R,W,X.^ND/)</i>)</dt><dd>
1226 Displays all files which are world readable and/or world writable and/or
1227 world executable (long output format).
1228 <p></p>
1229 </dd>
1230 <dt><b>lsx</b> (<i>ls -l *(*)</i>)</dt><dd>
1231 Lists only executable files.
1232 <p></p>
1233 </dd>
1234 <dt><b>mdstat</b> (<i>cat /proc/mdstat</i>)</dt><dd>
1235 Lists all active md (i.e. linux software raid) devices with some information
1236 about them.
1237 <p></p>
1238 </dd>
1239 <dt><b>mq</b> (<i>hg -R $(readlink -f $(hg root)/.hg/patches)</i>)</dt><dd>
1240 Executes the commands on the versioned patch queue from current repository.
1241 <p></p>
1242 </dd>
1243 <dt><b>rmcdir</b> (<i>'cd ..; rmdir $OLDPWD || cd $OLDPWD</i>)</dt><dd>
1244 rmdir current working directory
1245 <p></p>
1246 </dd>
1247 <dt><b>screen</b> (<i>screen -c file</i>)</dt><dd>
1248 If invoking user is root, starts screen session with /etc/grml/screenrc
1249 as config file. If invoked by a regular user and users .screenc does not exist,
1250 starts screen with /etc/grml/screenrc_grml config if it exists, else fallbacks
1251 to /etc/grml/screenrc.
1252 <p></p>
1253 </dd>
1254 <dt><b>su</b> (<i>sudo su</i>)</dt><dd>
1255 If user is running a Grml live system, don't ask for any password, if she
1256 wants a root shell.
1257 <p></p>
1258 </dd>
1259 <dt><b>term2iso</b> (<i>echo 'Setting terminal to iso mode' ; print -n '\e%@'</i>)</dt><dd>
1260 Sets mode from UTF-8 to ISO 2022 (See:
1261 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1262 <p></p>
1263 </dd>
1264 <dt><b>term2utf</b> (<i>echo 'Setting terminal to utf-8 mode'; print -n '\e%G'</i>)</dt><dd>
1265 Sets mode from ISO 2022 to UTF-8 (See:
1266 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1267 <p></p>
1268 </dd>
1269 <dt><b>tlog</b> (<i>tail -f /var/log/syslog</i>)</dt><dd>
1270 Prints syslog continuously (See tail(1)).
1271 <p></p>
1272 </dd>
1273 <dt><b>up</b> (<i>aptitude update ; aptitude safe-upgrade</i>)</dt><dd>
1274 Performs a system update followed by a system upgrade using aptitude; run
1275 by sudo, if necessary. See au and ag above.
1276 <p></p>
1277 </dd>
1278 <dt><b>url-quote</b> (<i>autoload -U url-quote-magic ; zle -N self-insert url-quote-magic</i>)</dt><dd>
1279 After calling, characters of URLs as typed get automatically escaped, if necessary, to
1280 protect them from the shell.
1281 <p></p>
1282 </dd>
1283 <dt><b>$(uname -r)-reboot</b> (<i>kexec -l --initrd=/boot/initrd.img-"$(uname -r)" --command-line=\"$(cat /proc/cmdline)\" /boot/vmlinuz-"$(uname -r)"</i>)</dt><dd>
1284 Reboots using kexec(8) and thus reduces boot time by skipping hardware initialization of BIOS/firmware.
1285 <p></p>
1286 </dd>
1287 <dt><b>...</b> (<i>cd ../../</i>)</dt><dd>
1288 Changes current directory two levels higher.
1289 </dd>
1290 </dl>
1291 <h1>AUXILIARY FILES</h1>
1292 <p>
1293 This is a set of files, that - if they exist - can be used to customize the
1294 behaviour of <i>grmlzshrc</i>.
1295 </p>
1296 <dl>
1297 <dt><b>.zshrc.pre</b></dt><dd>
1298 Sourced at the very beginning of <i>grmlzshrc</i>. Among other things, it can
1299 be used to permantenly change <i>grmlzshrc</i>'s STARTUP VARIABLES (see above):
1300
1301 <pre>
1302 # show battery status in RPROMPT
1303 GRML_DISPLAY_BATTERY=1
1304 # always load the complete setup, even for root
1305 GRML_ALWAYS_LOAD_ALL=1
1306 </pre>
1307 <p></p>
1308 </dd>
1309 <dt><b>.zshrc.local</b></dt><dd>
1310 Sourced right before loading <i>grmlzshrc</i> is finished. There is a global
1311 version of this file (/etc/zsh/zshrc.local) which is sourced before the
1312 user-specific one.
1313 <p></p>
1314 </dd>
1315 <dt><b>.zdirs</b></dt><dd>
1316 Directory listing for persistent dirstack (see above).
1317 <p></p>
1318 </dd>
1319 <dt><b>.important_commands</b></dt><dd>
1320 List of commands, used by persistent history (see above).
1321 </dd>
1322 </dl>
1323 <h1>INSTALLATION ON NON-DEBIAN SYSTEMS</h1>
1324 <p>
1325 On Debian systems (<a href="http://www.debian.org">http://www.debian.org</a>) - and possibly Ubuntu
1326 (<a href="http://www.ubuntu.com">http://www.ubuntu.com</a>) and similar systems - it is very easy to get
1327 <i>grmlzshrc</i> via grml's .deb repositories.
1328 </p>
1329 <p>
1330 On non-debian systems, that is not an option, but all is not lost:
1331
1332 </p>
1333 <pre>
1334 % wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
1335 </pre>
1336 <p>
1337 If you would also like to get separate function files (which you can put into
1338 your <b>$fpath</b>), you can browse and download them at:
1339 </p>
1340 <p>
1341 <a href="http://git.grml.org/?p=grml-etc-core.git;a=tree;f=usr_share_grml/zsh;hb=HEAD">http://git.grml.org/?p=grml-etc-core.git;a=tree;f=usr_share_grml/zsh;hb=HEAD</a>
1342 </p>
1343 <h1>ZSH REFCARD TAGS</h1>
1344 <p>
1345 If you read <i>grmlzshrc</i>'s code you may notice strange looking comments in
1346 it. These are there for a purpose. grml's zsh-refcard is automatically
1347 generated from the contents of the actual configuration file. However, we need
1348 a little extra information on which comments and what lines of code to take
1349 into account (and for what purpose).
1350 </p>
1351 <p>
1352 Here is what they mean:
1353 </p>
1354 <p>
1355 List of tags (comment types) used:
1356 </p>
1357 <dl>
1358 <dt><b>#a#</b></dt><dd>
1359 Next line contains an important alias, that should be included in the
1360 grml-zsh-refcard. (placement tag: @@INSERT-aliases@@)
1361 <p></p>
1362 </dd>
1363 <dt><b>#f#</b></dt><dd>
1364 Next line contains the beginning of an important function. (placement
1365 tag: @@INSERT-functions@@)
1366 <p></p>
1367 </dd>
1368 <dt><b>#v#</b></dt><dd>
1369 Next line contains an important variable. (placement tag:
1370 @@INSERT-variables@@)
1371 <p></p>
1372 </dd>
1373 <dt><b>#k#</b></dt><dd>
1374 Next line contains an important keybinding. (placement tag:
1375 @@INSERT-keybindings@@)
1376 <p></p>
1377 </dd>
1378 <dt><b>#d#</b></dt><dd>
1379 Hashed directories list generation: <i>start</i>: denotes the start of a list of
1380 'hash -d' definitions. <i>end</i>: denotes its end. (placement tag:
1381 @@INSERT-hasheddirs@@)
1382 <p></p>
1383 </dd>
1384 <dt><b>#A#</b></dt><dd>
1385 Abbreviation expansion list generation: <i>start</i>: denotes the beginning of
1386 abbreviations. <i>end</i>: denotes their end.
1387
1388 Lines within this section that end in '#d .*' provide extra documentation to
1389 be included in the refcard. (placement tag: @@INSERT-abbrev@@)
1390 <p></p>
1391 </dd>
1392 <dt><b>#m#</b></dt><dd>
1393 This tag allows you to manually generate refcard entries for code lines that
1394 are hard/impossible to parse.
1395 Example:
1396
1397 <pre>
1398 #m# k ESC-h Call the run-help function
1399 </pre>
1400
1401 That would add a refcard entry in the keybindings table for 'ESC-h' with the
1402 given comment.
1403
1404 So the syntax is: #m# &lt;section&gt; &lt;argument&gt; &lt;comment&gt;
1405 <p></p>
1406 </dd>
1407 <dt><b>#o#</b></dt><dd>
1408 This tag lets you insert entries to the 'other' hash. Generally, this should
1409 not be used. It is there for things that cannot be done easily in another way.
1410 (placement tag: @@INSERT-other-foobar@@)
1411 </dd>
1412 </dl>
1413 <p>
1414 All of these tags (except for m and o) take two arguments, the first
1415 within the tag, the other after the tag:
1416 </p>
1417 <p>
1418 #&lt;tag&gt;&lt;section&gt;# &lt;comment&gt;
1419 </p>
1420 <p>
1421 Where &lt;section&gt; is really just a number, which are defined by the @secmap
1422 array on top of 'genrefcard.pl'. The reason for numbers instead of names is,
1423 that for the reader, the tag should not differ much from a regular comment.
1424 For zsh, it is a regular comment indeed. The numbers have got the following
1425 meanings:
1426 </p>
1427 <dl>
1428 <dt><b>0</b></dt><dd>
1429 <i>default</i>
1430 <p></p>
1431 </dd>
1432 <dt><b>1</b></dt><dd>
1433 <i>system</i>
1434 <p></p>
1435 </dd>
1436 <dt><b>2</b></dt><dd>
1437 <i>user</i>
1438 <p></p>
1439 </dd>
1440 <dt><b>3</b></dt><dd>
1441 <i>debian</i>
1442 <p></p>
1443 </dd>
1444 <dt><b>4</b></dt><dd>
1445 <i>search</i>
1446 <p></p>
1447 </dd>
1448 <dt><b>5</b></dt><dd>
1449 <i>shortcuts</i>
1450 <p></p>
1451 </dd>
1452 <dt><b>6</b></dt><dd>
1453 <i>services</i>
1454 </dd>
1455 </dl>
1456 <p>
1457 So, the following will add an entry to the 'functions' table in the 'system'
1458 section, with a (hopefully) descriptive comment:
1459
1460 </p>
1461 <pre>
1462 #f1# Edit an alias via zle
1463 edalias() {
1464 </pre>
1465 <p>
1466
1467 It will then show up in the @@INSERT-aliases-system@@ replacement tag that can
1468 be found in 'grml-zsh-refcard.tex.in'. If the section number is omitted, the
1469 'default' section is assumed. Furthermore, in 'grml-zsh-refcard.tex.in'
1470 @@INSERT-aliases@@ is exactly the same as @@INSERT-aliases-default@@. If you
1471 want a list of <b>all</b> aliases, for example, use @@INSERT-aliases-all@@.
1472 </p>
1473 <h1>CONTRIBUTING</h1>
1474 <p>
1475 If you want to help to improve grml's zsh setup, clone the grml-etc-core
1476 repository from git.grml.org:
1477
1478 </p>
1479 <pre>
1480 % git clone git://git.grml.org/grml-etc-core.git
1481 </pre>
1482 <p>
1483 Make your changes, commit them; use '<b>git format-patch</b>' to create a series
1484 of patches and send those to the following address via '<b>git send-email</b>':
1485
1486 </p>
1487 <pre>
1488 grml-etc-core@grml.org
1489 </pre>
1490 <p>
1491 Doing so makes sure the right people get your patches for review and
1492 possibly inclusion.
1493 </p>
1494 <h1>STATUS</h1>
1495 <p>
1496 This manual page is the <b>reference</b> manual for <i>grmlzshrc</i>.
1497 </p>
1498 <p>
1499 That means that in contrast to the existing refcard it should document <b>every</b>
1500 aspect of the setup.
1501 </p>
1502 <p>
1503 This manual is currently not complete. If you want to help improving it, visit
1504 the following pages:
1505 </p>
1506 <p>
1507 <a href="http://wiki.grml.org/doku.php?id=zshrcmanual">http://wiki.grml.org/doku.php?id=zshrcmanual</a>
1508 </p>
1509 <p>
1510 <a href="http://lists.mur.at/pipermail/grml/2009-August/004609.html">http://lists.mur.at/pipermail/grml/2009-August/004609.html</a>
1511 </p>
1512 <p>
1513 Contributions are highly welcome.
1514 </p>
1515 <h1>AUTHORS</h1>
1516 <p>
1517 This manpage was written by Frank Terbeck &lt;<a href="mailto:ft@grml.org">ft@grml.org</a>&gt;, Joerg Woelke
1518 &lt;<a href="mailto:joewoe@fsmail.de">joewoe@fsmail.de</a>&gt;, Maurice McCarthy &lt;<a href="mailto:manselton@googlemail.com">manselton@googlemail.com</a>&gt; and Axel
1519 Beckert &lt;<a href="mailto:abe@deuxchevaux.org">abe@deuxchevaux.org</a>&gt;.
1520 </p>
1521 <h1>COPYRIGHT</h1>
1522 <p>
1523 Copyright (c) 2009-2013 Grml project &lt;<a href="http://grml.org">http://grml.org</a>&gt;
1524 </p>
1525 <p>
1526 This manpage is distributed under the terms of the GPL version 2.
1527 </p>
1528 <p>
1529 Most parts of grml's zshrc are distributed under the terms of GPL v2, too,
1530 except for <b>accept-line()</b> which are distributed under the same conditions
1531 as zsh itself (which is BSD-like).
1532 </p>
1533 </div>
1534 <!-- xhtml code generated by txt2tags 2.6 (http://txt2tags.org) -->
1535 <!-- cmdline: txt2tags -\-target xhtml -\-css-sugar -\-style t2t-modern.css -o- grmlzshrc.t2t -->
1536 </body></html>