c(3erl)
Hey bestie! You're looking at c(3erl), from the Erlang Module Definition set β the c command interface module. It's giving "shortcuts for the Erlang shell," and honestly? Iconic.
β¨ NAME β¨
c β Command interface module.
π DESCRIPTION π
This module enables users to enter the short form of some commonly used commands.
π Note: These functions are intended for interactive use in the Erlang shell only. The module prefix can be omitted.
π EXPORTS π
πΈ bt(Pid) -> ok | undefined πΈ
Types:
Pid = pid()
Stack backtrace for a process. Equivalent to erlang:process_display(Pid, backtrace).
π¦ c(Module) -> {ok, ModuleName} | error π¦
Types:
Module = file:name()
ModuleName = module()
Works like c(Module, []).
π₯ c(Module, Options) -> {ok, ModuleName} | error π₯
Types:
Module = file:name()
Options = [compile:option()] | compile:option()
ModuleName = module()
Compiles and then purges and loads the code for a module. Module can be either a module name or a source file path, with or without .erl extension.
If Module is a string, it is assumed to be a source file path, and the compiler will attempt to compile the source file with the options Options. If compilation fails, the old object file (if any) is deleted.
If Module is an atom, a source file with that exact name or with .erl extension will be looked for. If found, the source file is compiled with the options Options. If compilation fails, the old object file (if any) is deleted.
If Module is an atom and is not the path of a source file, then the code path is searched to locate the object file for the module and extract its original compiler options and source path. If the source file is not found in the original location, filelib:find_source/1 is used to search for it relative to the directory of the object file.
The source file is compiled with the original options appended to the given Options, the output replacing the old object file if and only if compilation succeeds.
π Notice that purging the code means that any processes lingering in old code for the module are killed without warning. For more information, see the code module.
π c(Module, Options, Filter) -> {ok, ModuleName} | error π
Types:
Module = atom()
Options = [compile:option()]
Filter = fun((compile:option()) -> boolean())
ModuleName = module()
Compiles and then purges and loads the code for module Module, which must be an atom.
The code path is searched to locate the object file for module Module and extract its original compiler options and source path. If the source file is not found in the original location, filelib:find_source/1 is used to search for it relative to the directory of the object file.
The source file is compiled with the original options appended to the given Options, the output replacing the old object file if and only if compilation succeeds. The function Filter specifies which elements to remove from the original compiler options before the new options are added. The Filter fun should return true for options to keep, and false for options to remove.
π Notice that purging the code means that any processes lingering in old code for the module are killed without warning. For more information, see the code module.
π cd(Dir) -> ok π
Types:
Dir = file:name()
Changes working directory to Dir, which can be a relative name, and then prints the name of the new working directory.
Example:
2> cd("../erlang").
/home/ron/erlang
π§ erlangrc(PathList) -> {ok, file:filename()} | {error, term()} π§
Types:
PathList = [Dir :: file:name()]
Search PathList and load .erlang resource file if found.
π flush() -> ok π
Flushes any messages sent to the shell.
π help() -> ok π
Displays help information: all valid shell internal commands, and commands in this module.
π h(Module :: module()) -> h_return() π
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
Print the documentation for Module.
π h(Module :: module(), Function :: function()) -> hf_return() π
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
hf_return() = h_return() | {error, function_missing}
Print the documentation for all Module:Functions (regardless of arity).
π h(Module :: module(), Function :: function(), Arity :: arity()) -> hf_return() π
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
hf_return() = h_return() | {error, function_missing}
Print the documentation for Module:Function/Arity.
π«Ά hcb(Module :: module()) -> h_return() π«Ά
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
Print the callback documentation for Module.
π«Ά hcb(Module :: module(), Callback :: atom()) -> hcb_return() π«Ά
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
hcb_return() = h_return() | {error, callback_missing}
Print the callback documentation for all Module:Callbacks (regardless of arity).
π«Ά hcb(Module :: module(), Callback :: atom(), Arity :: arity()) -> hcb_return() π«Ά
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
hcb_return() = h_return() | {error, callback_missing}
Print the callback documentation for Module:Callback/Arity.
π¦ ht(Module :: module()) -> h_return() π¦
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
Print the type documentation for Module.
π¦ ht(Module :: module(), Type :: atom()) -> ht_return() π¦
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
ht_return() = h_return() | {error, type_missing}
Print the type documentation for Type in Module regardless of arity.
π¦ ht(Module :: module(), Type :: atom(), Arity :: arity()) -> ht_return() π¦
Types:
h_return() =
ok | {error, missing | {unknown_format, unicode:chardata()}}
ht_return() = h_return() | {error, type_missing}
Print the type documentation for Type/Arity in Module.
β i() -> ok and ni() -> ok β
i() -> ok
ni() -> ok
i/0 displays system information, listing information about all processes. ni/0 does the same, but for all nodes in the network.
β i(X, Y, Z) -> [{atom(), term()}] β
Types:
X = Y = Z = integer() >= 0
Displays information about a process. Equivalent to process_info(pid(X, Y, Z)), but location transparent.
πΈ l(Module) -> code:load_ret() πΈ
Types:
Module = module()
Purges and loads, or reloads, a module by calling code:purge(Module) followed by code:load_file(Module).
π Notice that purging the code means that any processes lingering in old code for the module are killed without warning. For more information, see code/3.
π lc(Files) -> ok π
Types:
Files = [File]
File
Compiles a list of files by calling compile:file(File, [report_errors, report_warnings]) for each File in Files.
For information about File, see file:filename().
π§ lm() -> [code:load_ret()] π§
Reloads all currently loaded modules that have changed on disk (see mm()). Returns the list of results from calling l(M) for each such M.
π ls() -> ok π
Lists files in the current directory.
π ls(Dir) -> ok π
Types:
Dir = file:name()
Lists files in directory Dir or, if Dir is a file, only lists it.
π m() -> ok π
Displays information about the loaded modules, including the files from which they have been loaded.
π m(Module) -> ok π
Types:
Module = module()
Displays information about Module.
π mm() -> [module()] π
Lists all modified modules. Shorthand for code:modified_modules/0.
π₯ memory() -> [{Type, Size}] π₯
Types:
Type = atom()
Size = integer() >= 0
Memory allocation information. Equivalent to erlang:memory/0.
π₯ memory(Type) -> Size and memory(Types) -> [{Type, Size}] π₯
memory(Type) -> Size
memory(Types) -> [{Type, Size}]
Types:
Types = [Type]
Type = atom()
Size = integer() >= 0
Memory allocation information. Equivalent to erlang:memory/1.
π¦ nc(File) -> {ok, Module} | error and nc(File, Options) -> {ok, Module} | error π¦
nc(File) -> {ok, Module} | error
nc(File, Options) -> {ok, Module} | error
Types:
File = file:name()
Options = [Option] | Option
Option = compile:option()
Module = module()
Compiles and then loads the code for a file on all nodes. Options defaults to []. Compilation is equivalent to:
compile:file(File, Options ++ [report_errors, report_warnings])
π nl(Module) -> abcast | error π
Types:
Module = module()
Loads Module on all nodes.
π pid(X, Y, Z) -> pid() π
Types:
X = Y = Z = integer() >= 0
Converts X, Y, Z to pid <X.Y.Z>. This function is only to be used when debugging.
π§ pwd() -> ok π§
Prints the name of the working directory.
π
q() -> no_return() π
This function is shorthand for init:stop(), that is, it causes the node to stop in a controlled fashion.
β regs() -> ok and nregs() -> ok β
regs() -> ok
nregs() -> ok
regs/0 displays information about all registered processes. nregs/0 does the same, but for all nodes in the network.
πΈ uptime() -> ok πΈ
Prints the node uptime (as specified by erlang:statistics(wall_clock)) in human-readable form.
π₯ xm(ModSpec) -> void() π₯
Types:
ModSpec = Module | Filename
Module = atom()
Filename = string()
Finds undefined functions, unused functions, and calls to deprecated functions in a module by calling xref:m/1.
π¦ y(File) -> YeccRet π¦
Types:
File = name()
YeccRet
like okay so finishing that thought π β this one is literally yecc:file(File) in a trench coat. That's the whole personality. β¨
And if you're sitting there like "bestie what even is File?", breathe π β for the whole File = name() situation you go peek at filename(3erl). If it's YeccRet you're confused about, that's a yecc:file/2 field trip. iykyk.
y(File, Options)->YeccRetβ the deluxe two-argument version, and yes she ate π
Types, so you know exactly what you're holding:
File = name()
Options, YeccRet
Generates an LALR-1 parser. Equivalent to this, verbatim, no cap:
yecc:file(File, Options)
For intel on File = name(), the move is filename(3erl) π¦. For intel on Options and YeccRet, both of them, together, it's yecc:file/2 again. She's the main character of this whole page ngl π
β¨ SEE ALSO β¨
the friend group π«Ά go read these too, they're all connected:
and that's the page, bestie π that's it, that's the manual. Ericsson AB made this little icon and it's living in stdlib 4.3.1.3 under the very glamorous name c(3erl) β go forth and generate some parsers, mwah ππΈ
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms