1ZSHROADMAP(1) General Commands Manual ZSHROADMAP(1)
2
3
4
6 zshroadmap - informal introduction to the zsh manual
7
8 The Zsh Manual, like the shell itself, is large and often complicated.
9 This section of the manual provides some pointers to areas of the shell
10 that are likely to be of particular interest to new users, and indi‐
11 cates where in the rest of the manual the documentation is to be found.
12
14 When it starts, the shell reads commands from various files. These can
15 be created or edited to customize the shell. See the section
16 Startup/Shutdown Files in zsh(1).
17
18 If no personal initialization files exist for the current user, a func‐
19 tion is run to help you change some of the most common settings. It
20 won't appear if your administrator has disabled the zsh/newuser module.
21 The function is designed to be self-explanatory. You can run it by
22 hand with `autoload -Uz zsh-newuser-install; zsh-newuser-install -f'.
23 See also the section User Configuration Functions in zshcontrib(1).
24
26 Interaction with the shell uses the builtin Zsh Line Editor, ZLE. This
27 is described in detail in zshzle(1).
28
29 The first decision a user must make is whether to use the Emacs or Vi
30 editing mode as the keys for editing are substantially different.
31 Emacs editing mode is probably more natural for beginners and can be
32 selected explicitly with the command bindkey -e.
33
34 A history mechanism for retrieving previously typed lines (most simply
35 with the Up or Down arrow keys) is available; note that, unlike other
36 shells, zsh will not save these lines when the shell exits unless you
37 set appropriate variables, and the number of history lines retained by
38 default is quite small (30 lines). See the description of the shell
39 variables (referred to in the documentation as parameters) HISTFILE,
40 HISTSIZE and SAVEHIST in zshparam(1).
41
42 The shell now supports the UTF-8 character set (and also others if sup‐
43 ported by the operating system). This is (mostly) handled transpar‐
44 ently by the shell, but the degree of support in terminal emulators is
45 variable. There is some discussion of this in the shell FAQ,
46 http://zsh.dotsrc.org/FAQ/ . Note in particular that for combining
47 characters to be handled the option COMBINING_CHARS needs to be set.
48 Because the shell is now more sensitive to the definition of the char‐
49 acter set, note that if you are upgrading from an older version of the
50 shell you should ensure that the appropriate variable, either LANG (to
51 affect all aspects of the shell's operation) or LC_CTYPE (to affect
52 only the handling of character sets) is set to an appropriate value.
53 This is true even if you are using a single-byte character set includ‐
54 ing extensions of ASCII such as ISO-8859-1 or ISO-8859-15. See the
55 description of LC_CTYPE in zshparam(1).
56
57 Completion
58 Completion is a feature present in many shells. It allows the user to
59 type only a part (usually the prefix) of a word and have the shell fill
60 in the rest. The completion system in zsh is programmable. For exam‐
61 ple, the shell can be set to complete email addresses in arguments to
62 the mail command from your ~/.abook/addressbook; usernames, hostnames,
63 and even remote paths in arguments to scp, and so on. Anything that
64 can be written in or glued together with zsh can be the source of what
65 the line editor offers as possible completions.
66
67 Zsh has two completion systems, an old, so called compctl completion
68 (named after the builtin command that serves as its complete and only
69 user interface), and a new one, referred to as compsys, organized as
70 library of builtin and user-defined functions. The two systems differ
71 in their interface for specifying the completion behavior. The new
72 system is more customizable and is supplied with completions for many
73 commonly used commands; it is therefore to be preferred.
74
75 The completion system must be enabled explicitly when the shell starts.
76 For more information see zshcompsys(1).
77
78 Extending the line editor
79 Apart from completion, the line editor is highly extensible by means of
80 shell functions. Some useful functions are provided with the shell;
81 they provide facilities such as:
82
83 insert-composed-char
84 composing characters not found on the keyboard
85
86 match-words-by-style
87 configuring what the line editor considers a word when moving or
88 deleting by word
89
90 history-beginning-search-backward-end, etc.
91 alternative ways of searching the shell history
92
93 replace-string, replace-pattern
94 functions for replacing strings or patterns globally in the com‐
95 mand line
96
97 edit-command-line
98 edit the command line with an external editor.
99
100 See the section `ZLE Functions' in zshcontrib(1) for descriptions of
101 these.
102
104 The shell has a large number of options for changing its behaviour.
105 These cover all aspects of the shell; browsing the full documentation
106 is the only good way to become acquainted with the many possibilities.
107 See zshoptions(1).
108
110 The shell has a rich set of patterns which are available for file
111 matching (described in the documentation as `filename generation' and
112 also known for historical reasons as `globbing') and for use when pro‐
113 gramming. These are described in the section `Filename Generation' in
114 zshexpn(1).
115
116 Of particular interest are the following patterns that are not commonly
117 supported by other systems of pattern matching:
118
119 ** for matching over multiple directories
120
121 ~, ^ the ability to exclude patterns from matching when the
122 EXTENDED_GLOB option is set
123
124 (...) glob qualifiers, included in parentheses at the end of the pat‐
125 tern, which select files by type (such as directories) or
126 attribute (such as size).
127
129 Although the syntax of zsh is in ways similar to the Korn shell, and
130 therefore more remotely to the original UNIX shell, the Bourne shell,
131 its default behaviour does not entirely correspond to those shells.
132 General shell syntax is introduced in the section `Shell Grammar' in
133 zshmisc(1).
134
135 One commonly encountered difference is that variables substituted onto
136 the command line are not split into words. See the description of the
137 shell option SH_WORD_SPLIT in the section `Parameter Expansion' in zsh‐
138 expn(1). In zsh, you can either explicitly request the splitting (e.g.
139 ${=foo}) or use an array when you want a variable to expand to more
140 than one word. See the section `Array Parameters' in zshparam(1).
141
143 The most convenient way of adding enhancements to the shell is typi‐
144 cally by writing a shell function and arranging for it to be
145 autoloaded. Functions are described in the section `Functions' in zsh‐
146 misc(1). Users changing from the C shell and its relatives should
147 notice that aliases are less used in zsh as they don't perform argument
148 substitution, only simple text replacement.
149
150 A few general functions, other than those for the line editor described
151 above, are provided with the shell and are described in zshcontrib(1).
152 Features include:
153
154 promptinit
155 a prompt theme system for changing prompts easily, see the sec‐
156 tion `Prompt Themes'
157
158
159 zsh-mime-setup
160 a MIME-handling system which dispatches commands according to
161 the suffix of a file as done by graphical file managers
162
163 zcalc a calculator
164
165 zargs a version of xargs that makes the find command redundant
166
167 zmv a command for renaming files by means of shell patterns.
168
169
170
171zsh 5.0.2 December 21, 2012 ZSHROADMAP(1)