How to show all processes in Erlang?

13,081

Solution 1

registered() is returning all the processes, but the shell is truncating output.

you can print the result to see everything:

io:format("~p~n", [registered()]).

Solution 2

> rp(registered()). Documentation here

Solution 3

As long as your are in shell you can use regs():

1> regs().

** Registered procs on node nonode@nohost **
Name                  Pid          Initial Call                      Reds Msgs
application_controlle <0.33.0>     erlang:apply/2                   65717    0
code_server           <0.38.0>     erlang:apply/2                  592348    0
disk_log_server       <0.129.0>    disk_log_server:init/1             323    0
disk_log_sup          <0.128.0>    supervisor:disk_log_sup/1          367    0
dtls_connection_sup   <0.70.0>     supervisor:dtls_connectio           84    0
dtls_udp_sup          <0.71.0>     supervisor:dtls_udp_sup/1           81    0
erl_prim_loader       <0.6.0>      erlang:apply/2                24923843    0
erl_signal_server     <0.46.0>     gen_event:init_it/6                 51    0
...

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

Solution 4

I believe the easiest way is:

> io:write(registered()).
Share:
13,081

Related videos on Youtube

0xAX
Author by

0xAX

I'm a software engineer with a particular interest in the Linux, git, low-level programming and programming in general. Now I'm working as Erlang and Elixir developer at Travelping. Writing blog about erlang, elixir and low-level programming for x86_64. Author of the Linux Insides book. My linkedin profile. Twitter: @0xAX Github: @0xAX

Updated on November 06, 2020

Comments

  • 0xAX
    0xAX over 3 years

    I need get all registered process. I input register(). a

     mnesia_event,kernel_safe_sup,mnesia_monitor,mnesia_snmp_sup,
     mnesia_recover,mnesia_late_loader,mnesia_kernel_sup,inet_db,
     rex,kernel_sup,global_name_server,mnesia_checkpoint_sup,
     file_server_2,user,error_logger,global_group,mnesia_locker,
     standard_error_sup,popd_listener_sup,pop_fsm_sup,dets_sup,
     smtpd_listener_sup,disk_log_sup,disk_log_server,dets|...]
    

    How can i get all names registered process, without | ...] (truncation)?

    Thank you.

  • D.Nibon
    D.Nibon about 13 years
    I raise you with rp(registered()). Doc
  • Peer Stritzinger
    Peer Stritzinger about 13 years
    @D.Nibbon: Why not write your own answer so we can upvote it properly?
  • Peer Stritzinger
    Peer Stritzinger about 13 years
    +1 for the best solution to this, I missed rp() for a short way to display all of a structure without typing io:format abominations all the time. Thanks for pointing it out!
  • tumbudu
    tumbudu over 6 years
    Any way to know which process causing cpu load..?
  • Yan Foto
    Yan Foto over 6 years
    @knocker not really sure about that!

Related