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 i() -> ok
93
94 ni() -> ok
95
96 i/0 displays system information, listing information about all
97 processes. ni/0 does the same, but for all nodes the network.
98
99 i(X, Y, Z) -> [{atom(), term()}]
100
101 Types:
102
103 X = Y = Z = integer() >= 0
104
105 Displays information about a process, Equivalent to
106 process_info(pid(X, Y, Z)), but location transparent.
107
108 l(Module) -> code:load_ret()
109
110 Types:
111
112 Module = module()
113
114 Purges and loads, or reloads, a module by calling
115 code:purge(Module) followed by code:load_file(Module).
116
117 Notice that purging the code means that any processes lingering
118 in old code for the module are killed without warning. For more
119 information, see code/3.
120
121 lc(Files) -> ok
122
123 Types:
124
125 Files = [File]
126 File
127
128 Compiles a list of files by calling compile:file(File,
129 [report_errors, report_warnings]) for each File in Files.
130
131 For information about File, see file:filename().
132
133 lm() -> [code:load_ret()]
134
135 Reloads all currently loaded modules that have changed on disk
136 (see mm()). Returns the list of results from calling l(M) for
137 each such M.
138
139 ls() -> ok
140
141 Lists files in the current directory.
142
143 ls(Dir) -> ok
144
145 Types:
146
147 Dir = file:name()
148
149 Lists files in directory Dir or, if Dir is a file, only lists
150 it.
151
152 m() -> ok
153
154 Displays information about the loaded modules, including the
155 files from which they have been loaded.
156
157 m(Module) -> ok
158
159 Types:
160
161 Module = module()
162
163 Displays information about Module.
164
165 mm() -> [module()]
166
167 Lists all modified modules. Shorthand for code:modified_mod‐
168 ules/0.
169
170 memory() -> [{Type, Size}]
171
172 Types:
173
174 Type = atom()
175 Size = integer() >= 0
176
177 Memory allocation information. Equivalent to erlang:memory/0.
178
179 memory(Type) -> Size
180
181 memory(Types) -> [{Type, Size}]
182
183 Types:
184
185 Types = [Type]
186 Type = atom()
187 Size = integer() >= 0
188
189 Memory allocation information. Equivalent to erlang:memory/1.
190
191 nc(File) -> {ok, Module} | error
192
193 nc(File, Options) -> {ok, Module} | error
194
195 Types:
196
197 File = file:name()
198 Options = [Option] | Option
199 Option = compile:option()
200 Module = module()
201
202 Compiles and then loads the code for a file on all nodes.
203 Options defaults to []. Compilation is equivalent to:
204
205 compile:file(File, Options ++ [report_errors, report_warnings])
206
207 nl(Module) -> abcast | error
208
209 Types:
210
211 Module = module()
212
213 Loads Module on all nodes.
214
215 pid(X, Y, Z) -> pid()
216
217 Types:
218
219 X = Y = Z = integer() >= 0
220
221 Converts X, Y, Z to pid <X.Y.Z>. This function is only to be
222 used when debugging.
223
224 pwd() -> ok
225
226 Prints the name of the working directory.
227
228 q() -> no_return()
229
230 This function is shorthand for init:stop(), that is, it causes
231 the node to stop in a controlled fashion.
232
233 regs() -> ok
234
235 nregs() -> ok
236
237 regs/0 displays information about all registered processes.
238 nregs/0 does the same, but for all nodes in the network.
239
240 uptime() -> ok
241
242 Prints the node uptime (as specified by erlang:statis‐
243 tics(wall_clock)) in human-readable form.
244
245 xm(ModSpec) -> void()
246
247 Types:
248
249 ModSpec = Module | Filename
250 Module = atom()
251 Filename = string()
252
253 Finds undefined functions, unused functions, and calls to depre‐
254 cated functions in a module by calling xref:m/1.
255
256 y(File) -> YeccRet
257
258 Types:
259
260 File = name()
261 YeccRet
262
263 Generates an LALR-1 parser. Equivalent to:
264
265 yecc:file(File)
266
267 For information about File = name(), see filename(3). For infor‐
268 mation about YeccRet, see yecc:file/2.
269
270 y(File, Options) -> YeccRet
271
272 Types:
273
274 File = name()
275 Options, YeccRet
276
277 Generates an LALR-1 parser. Equivalent to:
278
279 yecc:file(File, Options)
280
281 For information about File = name(), see filename(3). For infor‐
282 mation about Options and YeccRet, see yecc:file/2.
283
285 filename(3), compile(3), erlang(3), yecc(3), xref(3)
286
287
288
289Ericsson AB stdlib 3.10 c(3)