c(3)
β¨ c β¨ β bestie, it's the command line interface module
okay so the module name is c and it lives in the Erlang manual, section 3 (c(3)). you're gonna love her, she's the shorthand queen. π
πΈ NAME πΈ
c β Command line interface module. that's it, that's the name, she does exactly what it says on the tin, no cap. π
π DESCRIPTION π
This module lets you type the short form of a bunch of commands you'd otherwise be typing the long way. Think of it as the group chat version of your Erlang tooling: same info, way fewer keystrokes. β¨
NOTE: these functions are meant for interactive use in the Erlang shell only. and the module prefix can be omitted. so like, you literally just typepwd().and notc:pwd().β the shell gets it, iykyk. π
π See Also
filename, compile, erlang, yecc, xref β go give them a lil read, they're the supporting cast. π«Ά
π DATA TYPES π
no thoughts, just types. here's the roster:
cmd_line_arg() :: atom() | string().
h_return() ::
ok | {error, missing | {unknown_format, unicode:chardata()}}.
hcb_return() :: h_return() | {error, callback_missing}.
hf_return() :: h_return() | {error, function_missing}.
ht_return() :: h_return() | {error, type_missing}.
they're giving "small but important", and honestly? slay. β
π₯ FUNCTIONS π₯
this is the main character section. let's go, one by one, no skipping, periodt. π
π bt(Pid) -> ok | undefined when Pid :: pid().
Stack backtrace for a process. Equivalent to erlang:process_display(Pid, backtrace).
so you hand her a pid and she gives you the backtrace, exactly like calling erlang:process_display(Pid, backtrace). simple, iconic. β¨
π c(Module) -> {ok, ModuleName} | error when Module :: file:name(), ModuleName :: module().
Works like c(Module, []).
literally just c(Module, []) with the vibes turned up. π
π c(Module, Options) -> {ok, ModuleName} | error
when
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.
k so here's the tea β, and you need to follow along because she's doing a lot of deciding:
- If
Moduleis a string, it's assumed to be a source file path, and the compiler will attempt to compile that source file with the optionsOptions. If compilation fails, the old object file (if any) is deleted. π - If
Moduleis an atom, a source file with that exact name or with.erlextension will be looked for. If found, it gets compiled withOptions. If compilation fails, the old object file (if any) is deleted. same energy, different branch. - If
Moduleis 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/1is used to search for it relative to the directory of the object file. π - The source file is compiled with the 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. bestie this is not a drill, that's real, she will not knock first. π
π c(Module, Options, Filter) -> {ok, ModuleName} | error
when
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 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. so like a lil bouncer at the door of your compile options π«Ά
β οΈ 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. yes she said it twice, because it matters twice. π
π cd(Dir) -> ok when Dir :: file:name().
Changes working directory to Dir, which can be a relative name, and then prints the name of the new working directory. she moves you AND announces it, main character behaviour fr fr. π
Example:
2> cd("../erlang").
/home/ron/erlang
π erlangrc(PathList) -> {ok, file:filename()} | {error, term()} when PathList :: [Dir :: file:name()].
Search PathList and load .erlang resource file if found. cute lil scavenger hunt for your dotfile. π
π flush() -> ok.
Flushes any messages sent to the shell. clear the queue, clear the mind, self care β¨
π h(module()) -> h_return().
Print the documentation for Module. π
π h(module(), function()) -> hf_return().
Print the documentation for all Module:Functions (regardless of arity). note: all of them, arity does NOT gatekeep here. π
π h(module(), function(), arity()) -> hf_return().
Print the documentation for Module:Function/Arity. specific girl. precise. love that for her. π―
π hcb(module()) -> h_return().
Print the callback documentation for Module. π¦
π hcb(module(), Callback :: atom()) -> hcb_return().
Print the callback documentation for all Module:Callbacks (regardless of arity). again, no arity filter, all are welcome. πΈ
π hcb(module(), Callback :: atom(), arity()) -> hcb_return().
Print the callback documentation for Module:Callback/Arity. one callback, one arity, one perfect lil answer. β
π help() -> ok.
Displays help information: all valid shell internal commands, and commands in this module. your lil cheat sheet, absolute lifesaver π
π ht(module()) -> h_return().
Print the type documentation for Module. types deserve love too π
π ht(module(), Type :: atom()) -> ht_return().
Print the type documentation for Type in Module regardless of arity. all arities, no gatekeeping, we love to see it. π
π ht(module(), Type :: atom(), arity()) -> ht_return().
Print the type documentation for Type/Arity in Module. laser focus. π
π i(X, Y, Z) -> [{atom(), term()}]
when
X :: non_neg_integer(),
Y :: non_neg_integer(),
Z :: non_neg_integer().
Old alias for pi(X, Y, Z). Note that the output of i(X, Y, Z) is very different from that of i(), so the new name is preferred.
β οΈ okay this one's a trap bestie π the old namei/3outputs something totally different fromi/0, which is exactly whypi(X, Y, Z)is the preferred glow-up. use the new name. periodt.
π l(Module) -> code:load_ret() when 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 | error when Files :: [File :: cmd_line_arg()].
Compiles a list of files by calling compile:file(File, [report_errors, report_warnings]) for each File in Files. a lil assembly line of compiling, we love efficiency β¨
For information about File, see file:filename/0.
π lm() -> [code:load_ret()].
Reloads all currently loaded modules that have changed on disk (see mm/0). Returns the list of results from calling l(M) for each such M. she notices what changed and takes care of it, attentive queen π
π ls() -> ok.
Lists files in the current directory. π
π ls(Dir) -> ok when Dir :: file:name().
Lists files in directory Dir or, if Dir is a file, only lists it. if you point at one file she's just gonna show you that one, no extras. π
π m() -> ok.
Displays information about the loaded modules, including the files from which they have been loaded. receipts, basically π§Ύβ¨
π m(Module) -> ok when Module :: module().
Displays information about Module. π
π memory() -> [{Type, Size}] when Type :: atom(), Size :: non_neg_integer().
Memory allocation information. Equivalent to erlang:memory/0. π§ β¨
π memory(Type) -> Size when Type :: atom(), Size :: non_neg_integer(); (Types) -> [{Type, Size}] when
Types :: [Type],
Type :: atom(),
Size :: non_neg_integer().
Memory allocation information. Equivalent to erlang:memory/1. plugs straight into erlang:memory/1, no middleman π
π mm() -> [module()].
Lists all modified modules. Shorthand for code:modified_modules/0. the "who changed?" report π
π nc(File, Options) -> {ok, Module} | error
when
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])
all nodes, bestie. all of them. network-wide slay ππ₯
π ni() -> ok.
i/0 displays system information, listing information about all processes. ni/0 does the same, but for all nodes in the network. same energy, wider net πΈοΈ
π nl(Module) -> abcast | error when Module :: module().
Loads Module on all nodes. yeet it everywhere π
π pi(Pid) -> [{atom(), term()}] when Pid :: pid().
Displays information about a process, Equivalent to process_info(Pid), but location transparent. she finds the process wherever it's at, no questions asked π«Ά
π pi(X, Y, Z) -> [{atom(), term()}]
when
X :: non_neg_integer(),
Y :: non_neg_integer(),
Z :: non_neg_integer().
Equivalent to pi(pid(X, Y, Z)). so it's just pi/1 with the pid built in for you. cute shortcut π
π pid(X, Y, Z) -> pid()
when
X :: non_neg_integer(),
Y :: non_neg_integer(),
Z :: non_neg_integer().
Converts X, Y, Z to pid <X.Y.Z>. This function is only to be used when debugging.
β οΈ only for debugging, okay? don't build your whole architecture on this one π
π pwd() -> ok.
Prints the name of the working directory. where am i? she'll tell you πβ¨
π q() -> no_return().
This function is shorthand for init:stop(), that is, it causes the node to stop in a controlled fashion. the gracious exit. the goodbye. slay and farewell ππ
π regs() -> ok.
regs/0 displays information about all registered processes. nregs/0 does the same, but for all nodes in the network. (yes, she mentions nregs/0 even though it's not in the list β that's just her being thorough, and we respect it.) π
π uptime() -> ok.
Prints the node uptime (as specified by erlang:statistics(wall_clock)) in human-readable form. "how long have we been here?" and she answers in a way humans can actually read. iconic. β°
π xm(module() | file:filename()) -> XRefMRet :: term().
Finds undefined functions, unused functions, and calls to deprecated functions in a module by calling xref:m/1. your lil code-hygiene detective πβ¨
π y(file:name()) -> YeccFileRet :: term().
Generates an LALR-1 parser. Equivalent to:
yecc:file(File)
For information about File = name(), see filename. For information about YeccRet, see yecc:file/2. parser generation but make it shorthand π¦
π y(file:name(), [yecc:option()]) -> YeccFileRet :: yecc:yecc_ret().
Generates an LALR-1 parser. Equivalent to:
yecc:file(File, Options)
For information about File = name(), see filename. For information about Options and YeccRet, see yecc:file/2. same parser, now with your options π
π«Ά THE SIGN-OFF π«Ά
and that's the whole page, bestie!! this one came from Ericsson AB, shipping with stdlib 8.0.4, and it's page c(3) of the Erlang manual. go type some short commands and feel powerful. no cap, you ate this. πβ¨ππ¦πΈπ
π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms