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