Erlang 常用命令

 

Erlang 安装

#wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el6.x86_64.rpm
安装Erlang
#yum install erlang-19.0.4-1.el6.x86_64.rpm -y

命令中文说明:

1> help().  
** shell 内置命令 **  
b()        -- 显示所有绑定的变量  
e(N)       -- 重复某次查询 <N>  
f()        -- 释放所有绑定的变量  
f(X)       -- 释放某个绑定的变量  
h()        -- 显示之前的操作  
history(N) -- 设置保存之前操作命令的条数  
results(N) -- 设置保存之前操作结果的条数  
catch_exception(Bool) -- 设置的执行过程中的异常处理  
v(N)       -- 使用某次查询的值 <N>  
rd(R,D)    -- 定义一个 record  
rf()       -- 移除所有 record  
rf(R)      -- 移除某个 record  
rl()       -- 显示所有 record  
rl(R)      -- 显示某个 record 信息  
rp(Term)   -- 显示某个元组的所有内容  
rr(File)   -- 从一个文件或模块读取 record 定义  
** c 模块命令 **  
bt(Pid)    -- 显示一个进程的栈回溯  
c(File)    -- 编译及重新加载模块  
cd(Dir)    -- 改变工作目录  
flush()    -- 刷新信箱(以便shell接收信息)  
help()     -- 帮助信息  
i()        -- 显示系统信息  
ni()       -- 和 i() 一样显示系统信息,还包括网络节点的系统信息  
i(X,Y,Z)   -- 通过 pid <X,Y,Z> 获取某个进程的信息  
l(Module)  -- 加载或重新加载模块  
lc([File]) -- 编译一个列表的 Erlang 模块  
ls()       -- 显示当前工作目录下的文件列表  
ls(Dir)    -- 显示某个目录下的文件列表  
m()        -- 显示已加载进系统的模块  
m(Mod)     -- 显示某个模块信息  
memory()   -- 显示内存分配信息  
memory(T)  -- 显示某项内存分配信息 <T>  
nc(File)   -- 在所有节点编译及加载模块  
nl(Module) -- 在所有节点重新加载模块  
pid(X,Y,Z) -- 通过 pid <X,Y,Z> 获取某个进程 pid  
pwd()      -- 显示当前工作目录  
q()        -- 关闭 erlang shell  
regs()     -- 显示注册过的进程信息  
nregs()    -- 和 regs() 一样显示注册过的进程信息,还包括网络节点的进程信息  
xm(M)      -- 查找某个模块未定义的函数,未使用的函数,已弃用的函数  
y(File)    -- 编译 Yecc 文件(.yrl)  
** i 模块命令  **  
ih()       -- 显示 i 模块的帮助信息  
true  

操作如下: 命令输入完,记得加 "."

在装了 erlang 的机器上 输入命令  erl

1> help().
** shell internal commands **
b()        -- display all variable bindings
e(N)       -- repeat the expression in query <N>
f()        -- forget all variable bindings
f(X)       -- forget the binding of variable X
h()        -- history
history(N) -- set how many previous commands to keep
results(N) -- set how many previous command results to keep
catch_exception(B) -- how exceptions are handled
v(N)       -- use the value of query <N>
rd(R,D)    -- define a record
rf()       -- remove all record information
rf(R)      -- remove record information about R
rl()       -- display all record information
rl(R)      -- display record information about R
rp(Term)   -- display Term using the shell's record information
rr(File)   -- read record information from File (wildcards allowed)
rr(F,R)    -- read selected record information from file(s)
rr(F,R,O)  -- read selected record information with options
** commands in module c **
bt(Pid)    -- stack backtrace for a process
c(File)    -- compile and load code in <File>
cd(Dir)    -- change working directory
flush()    -- flush any messages sent to the shell
help()     -- help info
i()        -- information about the system
ni()       -- information about the networked system
i(X,Y,Z)   -- information about pid <X,Y,Z>
l(Module)  -- load or reload module
lc([File]) -- compile a list of Erlang modules
ls()       -- list files in the current directory
ls(Dir)    -- list files in directory <Dir>
m()        -- which modules are loaded
m(Mod)     -- information about module <Mod>
memory()   -- memory allocation information
memory(T)  -- memory allocation information of type <T>
nc(File)   -- compile and load code in <File> on all nodes
nl(Module) -- load module on all nodes
pid(X,Y,Z) -- convert X,Y,Z to a Pid
pwd()      -- print working directory
q()        -- quit - shorthand for init:stop()
regs()     -- information about registered processes
nregs()    -- information about all registered processes
uptime()   -- print node uptime
xm(M)      -- cross reference check a module
y(File)    -- generate a Yecc parser
** commands in module i (interpreter interface) **
ih()       -- print help for the i module
true
2> regs(). 

** Registered procs on node nonode@nohost **
Name                  Pid          Initial Call                      Reds Msgs
application_controlle <0.31.0>     erlang:apply/2                     416    0
code_server           <0.36.0>     erlang:apply/2                   97110    0
erl_prim_loader       <0.4.0>      erlang:apply/2                  111727    0
error_logger          <0.30.0>     gen_event:init_it/6                226    0
erts_code_purger      <0.1.0>      erts_code_purger:start/0             4    0
file_server_2         <0.45.0>     file_server:init/1                  76    0
global_group          <0.44.0>     global_group:init/1                 55    0
global_name_server    <0.39.0>     global:init/1                       44    0
inet_db               <0.42.0>     inet_db:init/1                     200    0
init                  <0.0.0>      otp_ring0:start/2                  933    0
kernel_safe_sup       <0.54.0>     supervisor:kernel/1                 56    0
kernel_sup            <0.35.0>     supervisor:kernel/1               1659    0
rex                   <0.38.0>     rpc:init/1                          21    0
standard_error        <0.47.0>     erlang:apply/2                      10    0
standard_error_sup    <0.46.0>     supervisor_bridge:standar           34    0
user                  <0.50.0>     group:server/3                      40    0
user_drv              <0.49.0>     user_drv:server/2                 3198    0

** Registered ports on node nonode@nohost **
Name                  Id              Command                                 
ok

 

 

 

 

 

 

 

参考资料:

https://www.w3cschool.cn/erlang/mjpz1p6e.html

https://my.oschina.net/hackandhike/blog/801052

 

erl -sname root -remsh rmq@rmq -setcookie XXXXXXXXXXX
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wangxiaoming

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值