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