1c(3)                       Erlang Module Definition                       c(3)
2
3
4

NAME

6       c - Command interface module.
7

DESCRIPTION

9       This module enables users to enter the short form of some commonly used
10       commands.
11
12   Note:
13       These functions are intended for interactive use in  the  Erlang  shell
14       only. The module prefix can be omitted.
15
16

EXPORTS

18       bt(Pid) -> ok | undefined
19
20              Types:
21
22                 Pid = pid()
23
24              Stack backtrace for a process. Equivalent to erlang:process_dis‐
25              play(Pid, backtrace).
26
27       c(Module) -> {ok, ModuleName} | error
28
29              Types:
30
31                 Module = file:name()
32                 ModuleName = module()
33
34              Works like c(Module, []).
35
36       c(Module, Options) -> {ok, ModuleName} | error
37
38              Types:
39
40                 Module = file:name()
41                 Options = [compile:option()] | compile:option()
42                 ModuleName = module()
43
44              Compiles and then purges and loads the code for a module. Module
45              can be either a module name or a source file path, with or with‐
46              out .erl extension.
47
48              If Module is a string, it is assumed to be a source  file  path,
49              and  the  compiler  will attempt to compile the source file with
50              the options Options. If compilation fails, the old  object  file
51              (if any) is deleted.
52
53              If Module is an atom, a source file with that exact name or with
54              .erl extension will be looked for. If found, the source file  is
55              compiled with the options Options. If compilation fails, the old
56              object file (if any) is deleted.
57
58              If Module is an atom and is not the path of a source file,  then
59              the code path is searched to locate the object file for the mod‐
60              ule and extract its original compiler options and  source  path.
61              If  the  source  file  is  not  found  in the original location,
62              filelib:find_source/1 is used to search for it relative  to  the
63              directory of the object file.
64
65              The  source  file  is compiled with the the original options ap‐
66              pended to the given Options, the output replacing the old object
67              file if and only if compilation succeeds.
68
69              Notice  that purging the code means that any processes lingering
70              in old code for the module are killed without warning. For  more
71              information, see the code module.
72
73       c(Module, Options, Filter) -> {ok, ModuleName} | error
74
75              Types:
76
77                 Module = atom()
78                 Options = [compile:option()]
79                 Filter = fun((compile:option()) -> boolean())
80                 ModuleName = module()
81
82              Compiles  and  then purges and loads the code for module Module,
83              which must be an atom.
84
85              The code path is searched to locate the object file  for  module
86              Module  and  extract  its  original  compiler options and source
87              path. If the source file is not found in the original  location,
88              filelib:find_source/1  is  used to search for it relative to the
89              directory of the object file.
90
91              The source file is compiled with the the  original  options  ap‐
92              pended to the given Options, the output replacing the old object
93              file if and only if compilation succeeds.  The  function  Filter
94              specifies  which  elements  to remove from the original compiler
95              options before the new options are added. The Filter fun  should
96              return  true  for  options to keep, and false for options to re‐
97              move.
98
99              Notice that purging the code means that any processes  lingering
100              in  old code for the module are killed without warning. For more
101              information, see the code module.
102
103       cd(Dir) -> ok
104
105              Types:
106
107                 Dir = file:name()
108
109              Changes working directory to Dir, which can be a relative  name,
110              and then prints the name of the new working directory.
111
112              Example:
113
114              2> cd("../erlang").
115              /home/ron/erlang
116
117       erlangrc(PathList) -> {ok, file:filename()} | {error, term()}
118
119              Types:
120
121                 PathList = [Dir :: file:name()]
122
123              Search PathList and load .erlang resource file if found.
124
125       flush() -> ok
126
127              Flushes any messages sent to the shell.
128
129       help() -> ok
130
131              Displays  help  information:  all valid shell internal commands,
132              and commands in this module.
133
134       h(Module :: module()) -> h_return()
135
136              Types:
137
138                 h_return() =
139                     ok | {error, missing | {unknown_format, unicode:chardata()}}
140
141              Print the documentation for Module
142
143       h(Module :: module(), Function :: function()) -> hf_return()
144
145              Types:
146
147                 h_return() =
148                     ok | {error, missing | {unknown_format, unicode:chardata()}}
149                 hf_return() = h_return() | {error, function_missing}
150
151              Print the documentation for all Module:Functions (regardless  of
152              arity).
153
154       h(Module :: module(), Function :: function(), Arity :: arity()) ->
155            hf_return()
156
157              Types:
158
159                 h_return() =
160                     ok | {error, missing | {unknown_format, unicode:chardata()}}
161                 hf_return() = h_return() | {error, function_missing}
162
163              Print the documentation for Module:Function/Arity.
164
165       ht(Module :: module()) -> h_return()
166
167              Types:
168
169                 h_return() =
170                     ok | {error, missing | {unknown_format, unicode:chardata()}}
171
172              Print the type documentation for Module
173
174       ht(Module :: module(), Type :: atom()) -> ht_return()
175
176              Types:
177
178                 h_return() =
179                     ok | {error, missing | {unknown_format, unicode:chardata()}}
180                 ht_return() = h_return() | {error, type_missing}
181
182              Print  the  type  documentation for Type in Module regardless of
183              arity.
184
185       ht(Module :: module(), Type :: atom(), Arity :: arity()) ->
186             ht_return()
187
188              Types:
189
190                 h_return() =
191                     ok | {error, missing | {unknown_format, unicode:chardata()}}
192                 ht_return() = h_return() | {error, type_missing}
193
194              Print the type documentation for Type/Arity in Module.
195
196       i() -> ok
197
198       ni() -> ok
199
200              i/0 displays system information, listing information  about  all
201              processes. ni/0 does the same, but for all nodes the network.
202
203       i(X, Y, Z) -> [{atom(), term()}]
204
205              Types:
206
207                 X = Y = Z = integer() >= 0
208
209              Displays    information   about   a   process,   Equivalent   to
210              process_info(pid(X, Y, Z)), but location transparent.
211
212       l(Module) -> code:load_ret()
213
214              Types:
215
216                 Module = module()
217
218              Purges  and   loads,   or   reloads,   a   module   by   calling
219              code:purge(Module) followed by code:load_file(Module).
220
221              Notice  that purging the code means that any processes lingering
222              in old code for the module are killed without warning. For  more
223              information, see code/3.
224
225       lc(Files) -> ok
226
227              Types:
228
229                 Files = [File]
230                 File
231
232              Compiles  a  list  of  files  by calling compile:file(File, [re‐
233              port_errors, report_warnings]) for each File in Files.
234
235              For information about File, see file:filename().
236
237       lm() -> [code:load_ret()]
238
239              Reloads all currently loaded modules that have changed  on  disk
240              (see  mm()).  Returns  the list of results from calling l(M) for
241              each such M.
242
243       ls() -> ok
244
245              Lists files in the current directory.
246
247       ls(Dir) -> ok
248
249              Types:
250
251                 Dir = file:name()
252
253              Lists files in directory Dir or, if Dir is a  file,  only  lists
254              it.
255
256       m() -> ok
257
258              Displays  information  about  the  loaded modules, including the
259              files from which they have been loaded.
260
261       m(Module) -> ok
262
263              Types:
264
265                 Module = module()
266
267              Displays information about Module.
268
269       mm() -> [module()]
270
271              Lists all modified  modules.  Shorthand  for  code:modified_mod‐
272              ules/0.
273
274       memory() -> [{Type, Size}]
275
276              Types:
277
278                 Type = atom()
279                 Size = integer() >= 0
280
281              Memory allocation information. Equivalent to erlang:memory/0.
282
283       memory(Type) -> Size
284
285       memory(Types) -> [{Type, Size}]
286
287              Types:
288
289                 Types = [Type]
290                 Type = atom()
291                 Size = integer() >= 0
292
293              Memory allocation information. Equivalent to erlang:memory/1.
294
295       nc(File) -> {ok, Module} | error
296
297       nc(File, Options) -> {ok, Module} | error
298
299              Types:
300
301                 File = file:name()
302                 Options = [Option] | Option
303                 Option = compile:option()
304                 Module = module()
305
306              Compiles  and  then  loads the code for a file on all nodes. Op‐
307              tions defaults to []. Compilation is equivalent to:
308
309              compile:file(File, Options ++ [report_errors, report_warnings])
310
311       nl(Module) -> abcast | error
312
313              Types:
314
315                 Module = module()
316
317              Loads Module on all nodes.
318
319       pid(X, Y, Z) -> pid()
320
321              Types:
322
323                 X = Y = Z = integer() >= 0
324
325              Converts X, Y, Z to pid <X.Y.Z>. This function  is  only  to  be
326              used when debugging.
327
328       pwd() -> ok
329
330              Prints the name of the working directory.
331
332       q() -> no_return()
333
334              This  function  is shorthand for init:stop(), that is, it causes
335              the node to stop in a controlled fashion.
336
337       regs() -> ok
338
339       nregs() -> ok
340
341              regs/0 displays  information  about  all  registered  processes.
342              nregs/0 does the same, but for all nodes in the network.
343
344       uptime() -> ok
345
346              Prints   the   node   uptime  (as  specified  by  erlang:statis‐
347              tics(wall_clock)) in human-readable form.
348
349       xm(ModSpec) -> void()
350
351              Types:
352
353                 ModSpec = Module | Filename
354                  Module = atom()
355                  Filename = string()
356
357              Finds undefined functions, unused functions, and calls to depre‐
358              cated functions in a module by calling xref:m/1.
359
360       y(File) -> YeccRet
361
362              Types:
363
364                 File = name()
365                 YeccRet
366
367              Generates an LALR-1 parser. Equivalent to:
368
369              yecc:file(File)
370
371              For information about File = name(), see filename(3). For infor‐
372              mation about YeccRet, see yecc:file/2.
373
374       y(File, Options) -> YeccRet
375
376              Types:
377
378                 File = name()
379                 Options, YeccRet
380
381              Generates an LALR-1 parser. Equivalent to:
382
383              yecc:file(File, Options)
384
385              For information about File = name(), see filename(3). For infor‐
386              mation about Options and YeccRet, see yecc:file/2.
387

SEE ALSO

389       filename(3), compile(3), erlang(3), yecc(3), xref(3)
390
391
392
393Ericsson AB                      stdlib 3.16.1                            c(3)
Impressum