SlideShare a Scribd company logo
1 of 24
Download to read offline
IEx Cheat Sheet
@troush69 | github.com/Troush
Presentation.Supervisor.start_link(self(), {:slide, 1})
Starting IEx
1 iex
2
3 iex -S mix #Starting IEx in the context of your app
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”
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
Ctrl + g
1 User switch command
2 --> s 'Elixir.IEx'
3 --> c
4
5
6 User switch command
7 --> c 1
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
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)
.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.
.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)>
Configuring the shell
No limit on IO.inspect
IEx.configure [inspect: [limit: :infinity]]
IEx Helpers
h Module
h
Module.fn/arity
v(n  -1)
Returns the value of the nth expression in the history.
IEx.pry()
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.
respawn
Respawns the current shell by starting a new shell process.
Returns true if it worked.
Debugging
Phoenix
Views
Debugging
Phoenix
Templates
Debugging
Phoenix
Tests
Don’t forget to run your test
suite with:
iex -S mix test --trace
Questions?

More Related Content

What's hot

6 new ES6 features
6 new ES6 features6 new ES6 features
6 new ES6 features
Kyle Dorman
 
7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux
chinkshady
 
Clojure and Modularity
Clojure and ModularityClojure and Modularity
Clojure and Modularity
elliando dias
 

What's hot (20)

[D2 Campus] Tech meetup (주제: Android) 모바일 머신러닝 [열일한 내 거북ᄆ...
[D2 Campus] Tech meetup (주제: Android) 모바일 머신러닝 [열일한 내 거북ᄆ...[D2 Campus] Tech meetup (주제: Android) 모바일 머신러닝 [열일한 내 거북ᄆ...
[D2 Campus] Tech meetup (주제: Android) 모바일 머신러닝 [열일한 내 거북ᄆ...
 
Unix Programming with Perl 2
Unix Programming with Perl 2Unix Programming with Perl 2
Unix Programming with Perl 2
 
Magic Clusters and Where to Find Them - Eugene Pirogov
Magic Clusters and Where to Find Them - Eugene PirogovMagic Clusters and Where to Find Them - Eugene Pirogov
Magic Clusters and Where to Find Them - Eugene Pirogov
 
LvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncioLvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncio
 
6 new ES6 features
6 new ES6 features6 new ES6 features
6 new ES6 features
 
7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux
 
Clojure and Modularity
Clojure and ModularityClojure and Modularity
Clojure and Modularity
 
Shell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEAShell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEA
 
Functuon
FunctuonFunctuon
Functuon
 
RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)
 
Owasp orlando, april 13, 2016
Owasp orlando, april 13, 2016Owasp orlando, april 13, 2016
Owasp orlando, april 13, 2016
 
Backdoor coding
Backdoor codingBackdoor coding
Backdoor coding
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
Async java8
Async java8Async java8
Async java8
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
 
シェル芸でライフハック(特論)
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)
 
Jest
JestJest
Jest
 
Inheritance
InheritanceInheritance
Inheritance
 
Oop lecture9 12
Oop lecture9 12Oop lecture9 12
Oop lecture9 12
 
Cooking pies with Celery
Cooking pies with CeleryCooking pies with Celery
Cooking pies with Celery
 

Viewers also liked

Sharekhanlimited 140315092431-phpapp01 (repaired)
Sharekhanlimited 140315092431-phpapp01 (repaired)Sharekhanlimited 140315092431-phpapp01 (repaired)
Sharekhanlimited 140315092431-phpapp01 (repaired)
deolal
 
Thriller Sub Genre research
Thriller Sub Genre research Thriller Sub Genre research
Thriller Sub Genre research
gsolman
 
Lightning Talk: Erlang on Xen - Mikhail Bortnyk
Lightning Talk: Erlang on Xen - Mikhail BortnykLightning Talk: Erlang on Xen - Mikhail Bortnyk
Lightning Talk: Erlang on Xen - Mikhail Bortnyk
Elixir Club
 

Viewers also liked (17)

Estudio Demografía Empresarial febrero 2017
Estudio Demografía Empresarial febrero 2017Estudio Demografía Empresarial febrero 2017
Estudio Demografía Empresarial febrero 2017
 
Direcion IP
Direcion IPDirecion IP
Direcion IP
 
3 l1 b 1 часть
3 l1 b 1 часть3 l1 b 1 часть
3 l1 b 1 часть
 
Sharekhanlimited 140315092431-phpapp01 (repaired)
Sharekhanlimited 140315092431-phpapp01 (repaired)Sharekhanlimited 140315092431-phpapp01 (repaired)
Sharekhanlimited 140315092431-phpapp01 (repaired)
 
Hva bør du vite om digital markedsføring?
Hva bør du vite om digital markedsføring?Hva bør du vite om digital markedsføring?
Hva bør du vite om digital markedsføring?
 
Thriller Sub Genre research
Thriller Sub Genre research Thriller Sub Genre research
Thriller Sub Genre research
 
Dsp course
Dsp courseDsp course
Dsp course
 
Tarea del seminario 2
Tarea del seminario 2 Tarea del seminario 2
Tarea del seminario 2
 
Jurnal CDIMM nr. 3/2017_Europe Direct Maramures
Jurnal CDIMM nr. 3/2017_Europe Direct MaramuresJurnal CDIMM nr. 3/2017_Europe Direct Maramures
Jurnal CDIMM nr. 3/2017_Europe Direct Maramures
 
Final project
Final projectFinal project
Final project
 
Maksym Pugach - Elixir Release and Deploy Utilities
Maksym Pugach - Elixir Release and Deploy UtilitiesMaksym Pugach - Elixir Release and Deploy Utilities
Maksym Pugach - Elixir Release and Deploy Utilities
 
Sonasid : Comptes annuels de l'exercice 2016
Sonasid : Comptes annuels de l'exercice 2016 Sonasid : Comptes annuels de l'exercice 2016
Sonasid : Comptes annuels de l'exercice 2016
 
Lightning Talk: Erlang on Xen - Mikhail Bortnyk
Lightning Talk: Erlang on Xen - Mikhail BortnykLightning Talk: Erlang on Xen - Mikhail Bortnyk
Lightning Talk: Erlang on Xen - Mikhail Bortnyk
 
GenStage and Flow - Jose Valim
GenStage and Flow - Jose Valim GenStage and Flow - Jose Valim
GenStage and Flow - Jose Valim
 
bridal ring
bridal ringbridal ring
bridal ring
 
21 Sites com Exercícios de Inglês Grátis
21 Sites com Exercícios de Inglês Grátis21 Sites com Exercícios de Inglês Grátis
21 Sites com Exercícios de Inglês Grátis
 
Fruits head
Fruits headFruits head
Fruits head
 

Similar to Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job

Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Elixir Club
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
ashukiller7
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
Paul Lam
 

Similar to Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job (20)

Origins of Elixir programming language
Origins of Elixir programming languageOrigins of Elixir programming language
Origins of Elixir programming language
 
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
 
Slides
SlidesSlides
Slides
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
(Fun clojure)
(Fun clojure)(Fun clojure)
(Fun clojure)
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
 
101 3.1 gnu and unix commands v4
101 3.1 gnu and unix commands v4101 3.1 gnu and unix commands v4
101 3.1 gnu and unix commands v4
 
python within 50 page .ppt
python within 50 page .pptpython within 50 page .ppt
python within 50 page .ppt
 
Lightweight Virtualization: LXC containers & AUFS
Lightweight Virtualization: LXC containers & AUFSLightweight Virtualization: LXC containers & AUFS
Lightweight Virtualization: LXC containers & AUFS
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 
UNIX Basics and Cluster Computing
UNIX Basics and Cluster ComputingUNIX Basics and Cluster Computing
UNIX Basics and Cluster Computing
 
3.1 gnu and unix commands v4
3.1 gnu and unix commands v43.1 gnu and unix commands v4
3.1 gnu and unix commands v4
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
01_linux_basics.ppt
01_linux_basics.ppt01_linux_basics.ppt
01_linux_basics.ppt
 
11_UNIX_Processes_Including_Select.ppt
11_UNIX_Processes_Including_Select.ppt11_UNIX_Processes_Including_Select.ppt
11_UNIX_Processes_Including_Select.ppt
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
 
10.8.2018
10.8.201810.8.2018
10.8.2018
 

More from Elixir Club

More from Elixir Club (20)

Kubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club Ukraine
Kubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club UkraineKubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club Ukraine
Kubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club Ukraine
 
Integrating 3rd parties with Ecto - Eduardo Aguilera | Elixir Club Ukraine
Integrating 3rd parties with Ecto -  Eduardo Aguilera | Elixir Club UkraineIntegrating 3rd parties with Ecto -  Eduardo Aguilera | Elixir Club Ukraine
Integrating 3rd parties with Ecto - Eduardo Aguilera | Elixir Club Ukraine
 
— An async template - Oleksandr Khokhlov | Elixir Club Ukraine
— An async template  -  Oleksandr Khokhlov | Elixir Club Ukraine— An async template  -  Oleksandr Khokhlov | Elixir Club Ukraine
— An async template - Oleksandr Khokhlov | Elixir Club Ukraine
 
BEAM architecture handbook - Andrea Leopardi | Elixir Club Ukraine
BEAM architecture handbook - Andrea Leopardi  | Elixir Club UkraineBEAM architecture handbook - Andrea Leopardi  | Elixir Club Ukraine
BEAM architecture handbook - Andrea Leopardi | Elixir Club Ukraine
 
You ain't gonna need write a GenServer - Ulisses Almeida | Elixir Club Ukraine
You ain't gonna need write a GenServer - Ulisses Almeida  | Elixir Club UkraineYou ain't gonna need write a GenServer - Ulisses Almeida  | Elixir Club Ukraine
You ain't gonna need write a GenServer - Ulisses Almeida | Elixir Club Ukraine
 
— Knock, knock — An async templates — Who’s there? - Alexander Khokhlov | ...
 — Knock, knock — An async templates — Who’s there? - Alexander Khokhlov  |  ... — Knock, knock — An async templates — Who’s there? - Alexander Khokhlov  |  ...
— Knock, knock — An async templates — Who’s there? - Alexander Khokhlov | ...
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
 
Erlang cluster. How is it? Production experience. — Valerii Vasylkov | Elixi...
Erlang cluster. How is it? Production experience. —  Valerii Vasylkov | Elixi...Erlang cluster. How is it? Production experience. —  Valerii Vasylkov | Elixi...
Erlang cluster. How is it? Production experience. — Valerii Vasylkov | Elixi...
 
Promo Phx4RailsDevs - Volodya Sveredyuk
Promo Phx4RailsDevs - Volodya SveredyukPromo Phx4RailsDevs - Volodya Sveredyuk
Promo Phx4RailsDevs - Volodya Sveredyuk
 
Web of today — Alexander Khokhlov
Web of today —  Alexander KhokhlovWeb of today —  Alexander Khokhlov
Web of today — Alexander Khokhlov
 
ElixirConf Eu 2018, what was it like? – Eugene Pirogov
ElixirConf Eu 2018, what was it like? – Eugene PirogovElixirConf Eu 2018, what was it like? – Eugene Pirogov
ElixirConf Eu 2018, what was it like? – Eugene Pirogov
 
Implementing GraphQL API in Elixir – Victor Deryagin
Implementing GraphQL API in Elixir – Victor DeryaginImplementing GraphQL API in Elixir – Victor Deryagin
Implementing GraphQL API in Elixir – Victor Deryagin
 
WebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan WintermeyerWebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan Wintermeyer
 
GenServer in Action – Yurii Bodarev
GenServer in Action – Yurii Bodarev   GenServer in Action – Yurii Bodarev
GenServer in Action – Yurii Bodarev
 
Russian Doll Paradox: Elixir Web without Phoenix - Alex Rozumii
Russian Doll Paradox: Elixir Web without Phoenix - Alex RozumiiRussian Doll Paradox: Elixir Web without Phoenix - Alex Rozumii
Russian Doll Paradox: Elixir Web without Phoenix - Alex Rozumii
 
Practical Fault Tolerance in Elixir - Alexei Sholik
Practical Fault Tolerance in Elixir - Alexei SholikPractical Fault Tolerance in Elixir - Alexei Sholik
Practical Fault Tolerance in Elixir - Alexei Sholik
 
Phoenix and beyond: Things we do with Elixir - Alexander Khokhlov
Phoenix and beyond: Things we do with Elixir - Alexander KhokhlovPhoenix and beyond: Things we do with Elixir - Alexander Khokhlov
Phoenix and beyond: Things we do with Elixir - Alexander Khokhlov
 
Monads are just monoids in the category of endofunctors - Ike Kurghinyan
Monads are just monoids in the category of endofunctors - Ike KurghinyanMonads are just monoids in the category of endofunctors - Ike Kurghinyan
Monads are just monoids in the category of endofunctors - Ike Kurghinyan
 
Craft effective API with GraphQL and Absinthe - Ihor Katkov
Craft effective API with GraphQL and Absinthe - Ihor KatkovCraft effective API with GraphQL and Absinthe - Ihor Katkov
Craft effective API with GraphQL and Absinthe - Ihor Katkov
 
Elixir in a service of government - Alex Troush
Elixir in a service of government - Alex TroushElixir in a service of government - Alex Troush
Elixir in a service of government - Alex Troush
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job

  • 1. IEx Cheat Sheet @troush69 | github.com/Troush
  • 3. Starting IEx 1 iex 2 3 iex -S mix #Starting IEx in the context of your app
  • 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)>
  • 12.
  • 13. No limit on IO.inspect IEx.configure [inspect: [limit: :infinity]]
  • 17. v(n -1) Returns the value of the nth expression in the history.
  • 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.
  • 20. respawn Respawns the current shell by starting a new shell process. Returns true if it worked.
  • 23. Debugging Phoenix Tests Don’t forget to run your test suite with: iex -S mix test --trace