LinuxCommandLibrary

elixir

Compile and run Elixir code

TLDR

Run an Elixir file

$ elixir [path/to/file]
copy

Evaluate Elixir code by passing it as an argument
$ elixir [[-e|--eval]] "[code]"
copy

SYNOPSIS

elixir [options] [file]

PARAMETERS

-v
    Print the Elixir version.

-e code
    Evaluate code directly from the command line.

-h
    Display help information.

-r directory
    Specifies root directory for the Erlang runtime.

-pa path
    Prepends path to Erlang code path.

-pz path
    Appends path to Erlang code path.

file
    The Elixir file to execute.

DESCRIPTION

The elixir command is the primary entry point for interacting with the Elixir programming language on Linux. It's used to compile, execute, and manage Elixir projects. It starts the Elixir runtime environment, allowing you to run Elixir scripts, start interactive Elixir shells (IEx), and compile Elixir source code.
It acts as a command-line interface to the Erlang BEAM virtual machine, providing tools for development, debugging, and deployment. Key functionalities include executing Elixir files, compiling source code to bytecode, providing interactive shells for experimentation, and managing dependencies within an Elixir project using Mix (a build tool and package manager). It simplifies the process of building and running Elixir applications, offering a convenient way to leverage the language's features and capabilities.

IEX INTEGRATION

When used without a file argument, the elixir command starts an Interactive Elixir shell (IEx) offering a
REPL (Read-Eval-Print Loop) environment. This is helpful for interactive exploration and experimentation with the language.

ERROR HANDLING

If the provided Elixir file contains syntax errors or runtime exceptions, the elixir command reports the errors to the console. Debugging information is provided.

HISTORY

Elixir, created by José Valim, was first publicly released in 2012. The elixir command came with it, providing the basic executable for running the Elixir code. The Elixir language was created to improve developer productivity and extend the Erlang VM to take advantage of scalability and fault-tolerance. The command has been developed alongside the language, with new features added to it alongside each new Elixir release.

SEE ALSO

iex(1), mix(1)

Copied to clipboard