# c

### MODULE

c

### MODULE SUMMARY

Command Interface Module

### DESCRIPTION

The `c` module enables users to enter the short form of some commonly used commands. These functions are are intended for interactive use in the Erlang shell.

### EXPORTS

`bt(Pid) -> void()`

Types:

`Pid = pid()`

This function evaluates `erlang:process_display(Pid, backtrace)`.

`c(File) -> CompileResult`

This function is equivalent to:

`compile:file(File,[report_errors, report_warnings])`

`c(File, Flags) -> CompileResult`

Types:

`File = atom() | string()`
`CompileResult = {ok, ModuleName} | error`
`ModuleName = atom()`
`Flags = [Flag]`

This function calls the following function and then purges and loads the code for the file:

`compile:file(File, Flags ++ [report_errors, report_warnings])`

If the module corresponding to `File` is being interpreted, then `int:i` is called with the same arguments and the module is loaded into the interpreter. Note that `int:i` only recognizes a subset of the options recognized by `compile:file`.

Extreme care should be exercised when using this command to change running code which is executing. The expected result may not be obtained.

Refer to `compiler` manual pages for a description of the individual compiler flags.

`cd(Dir) -> void()`

Types:

`Dir = atom() | string()`

This function changes the current working directory to `Dir`, and then prints the new working directory.

`flush() -> void()`

This function flushes all messages in the shell message queue.

`help() -> void()`

This function displays help about the shell and about the command interface module.

`i() -> void()`

This function provides information about the current state of the system. This call uses the BIFs `processes()` and `process_info/1` to examine the current state of the system. (The code is a good introduction to these two BIFs).

`i(X, Y, Z) -> void()`

Types:

`X = Y = Z = int()`

This function evaluates `process_info(pid(X, Y, Z))`.

`l(Module) -> void()`

Types:

`Module = atom() | string()`

This function evaluates `code:purge(Module)` followed by `code:load_module(Module)`. It reloads the module.

`lc(ListOfFiles) -> Result`

Types:

`ListOfFiles = [File]`
`File = atom() | string()`
`Result = [CompileResult]`
`CompileResult = {ok, ModuleName} | error`
`ModuleName = atom()`

This function compiles several files by calling `c(File)` for each file in `ListOfFiles`.

`ls() -> void()`

This function lists all files in the current directory.

`ls(Dir) -> void()`

Types:

`Dir = atom() | string()`

This function lists all files in the directory `Dir`.

`m() -> void()`

This function lists the modules which have been loaded and the files from which they have been loaded.

`m(Module) -> void()`

Types:

`Module = atom()`

This function lists information about `Module`.

`memory() -> MemoryInformation`

The same as `erlang:memory/0`, see the `erlang(3)` man page.

`memory(MemoryTypeSpecification) -> MemoryInformation`

The same as `erlang:memory/1`, see the `erlang(3)` man page.

`nc(File) -> void()`

Types:

`File = atom() | string()`

This function compiles `File` and loads it on all nodes in an Erlang nodes network.

`nc(File, Flags) -> void()`

Types:

`File = atom() | string()`
`Flags = [Flag]`

This function compiles `File` with the additional compiler flags `Flags` and loads it on all nodes in an Erlang nodes network. Refer to the `compile` manual pages for a description of `Flags`.

`ni() -> void()`

This function does the same as `i()`, but for all nodes in the network.

`nl(Module) -> void()`

Types:

`Module = atom()`

This function loads `Module` on all nodes in an Erlang nodes network.

`nregs() -> void()`

This function is the same as `regs()`, but on all nodes in the system.

`pid(X, Y, Z) -> pid()`

Types:

`X = Y = Z = int()`

This function converts the integers `X`, `Y`, and `Z` to the Pid `<X.Y.Z>`. It saves typing and the use of `list_to_pid/1`. This function should only be used when debugging.

`pwd() -> void()`

This function prints the current working directory.

`q() -> void()`

This function is shorthand for `init:stop()`, i.e., it causes the node to stop in a controlled fashion.

`regs() -> void()`

This function displays formatted information about all registered processes in the system.

`xm(ModSpec) -> void()`

Types:

`ModSpec = Module | File`
`Module = atom()`
`File = string()`

This function finds undefined functions and unused functions in a module by calling `xref:m/1`.

`zi() -> void()`

This function works like `i()`, but additionally displays information about zombie processes, i.e., processes which have exited, but which are still kept in the system to be inspected.

### See Also

erlang(3)

### AUTHORS

Joe Armstrong - support@erlang.ericsson.se
Robert Virding - support@erlang.ericsson.se
Claes Wikström - support@erlang.ericsson.se

stdlib 1.12
Copyright © 1991-2003 Ericsson Utvecklings AB