This document provides an overview of useful commands and features in IEx, Elixir's interactive shell:
1. It describes how to start IEx with "iex" or "iex -S mix" to start in a project context.
2. It explains the Ctrl-C, Ctrl-G, and Ctrl-\ commands for interrupting, switching jobs, and exiting IEx.
3. It notes that the .iex.exs file can be used to configure the IEx shell on start up.
4. It lists some IEx helpers like h, v, IEx.pry, r, and respawn for getting help, viewing history, debugging,
4. 1 iex(1)> sum = fn (a, b) ->
2 ...(1)> c + b
3 BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
4 (v)ersion (k)ill (D)b-tables (d)istribution
“ctrl+c”
5. Ctrl + c menu actually `erl` shell menu
● (a)bort - abort interactive mode. Eg: Exit
● (c)ontinue - continue interactive mode
● (p)roc info - get processes information
● (i)nfo - get Erlang runtime information
● (l)oaded – list of loaded modules to current shell
● (v)ersion – version of `erl`
● (k)ill – kill process menu
● (D)b-tables - get info about d/ets avaible in current
shell
● (d)istribution - distribution info
6. Ctrl + g
1 User switch command
2 --> s 'Elixir.IEx'
3 --> c
4
5
6 User switch command
7 --> c 1
7. Ctrl + g
● c [nn] - connect to job
● i [nn] - interrupt job
● k [nn] - kill job
● j - list all jobs
● s [shell] - start local shell
● r [node [shell]] - start remote shell
● q - quit erlang
● ? | h - this message
8. Ctrl-
What I didn’t know is that you can exit the shell by sending Ctrl-. The shell will
exit immediately. As far as I know, it has the same effect as aborting the
shell in the Break command, it doesn’t affect remote nodes and it also
works outside of iex (for example, you can use to terminate your tests)
9. .iex.ex
Every time IEx starts it will look for a .iex.exs configuration file. If it’s not
present in the current directory, then the user’s home directory
(~/.iex.exs) will be used as the fallback.
10. .iex.ex
1 IO.puts "Hello, World"
$ iex
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.4.0) - press Ctrl+C to exit (type h() ENTER for help)
Hello, World
iex(1)>
19. r(module)
Recompiles and reloads the given module.
Please note that all the modules defined in the same file as
module are recompiled and reloaded.