LinuxCommandLibrary

julia

Execute Julia programs and enter REPL

TLDR

Start a REPL (interactive shell)

$ julia
copy

Execute a Julia program and exit
$ julia [program.jl]
copy

Execute a Julia program that takes arguments
$ julia [program.jl] [arguments]
copy

Evaluate a string containing Julia code
$ julia [[-e|--eval]] '[julia_code]'
copy

Evaluate a string of Julia code, passing arguments to it
$ julia [[-e|--eval]] '[for x in ARGS; println(x); end]' [arguments]
copy

Evaluate an expression and print the result
$ julia [[-E|--print]] '[(1 - cos(pi/4))/2]'
copy

Start Julia in multithreaded mode, using n threads
$ julia [[-t|--threads]] [n]
copy

SYNOPSIS

julia [options] [programfile] [args...]

PARAMETERS

-h, --help
    Display help message and exit.

-v, --version
    Display version information and exit.

-e, --eval command
    Evaluate a command.

-E, --print command
    Evaluate a command and print the result.

-i, --interactive
    Force interactive mode, even if running in a pipe.

-q, --quiet
    Suppress printing of startup messages.

-p, --procs n
    Start n worker processes. Defaults to the number of local CPU threads.

--project[=]
    Set as the project environment. By default, uses the current directory.

programfile
    The Julia source file to execute.

args...
    Arguments passed to the Julia script.

DESCRIPTION

The `julia` command starts an interactive Julia session or executes Julia code from a file. Julia is a high-level, high-performance, dynamic programming language for technical computing. It's designed for numerical and scientific computing and data science, offering speed comparable to compiled languages like C while maintaining the expressiveness and ease of use of dynamic languages. The Julia REPL (Read-Eval-Print Loop) provides an interactive environment for executing commands, defining functions, and exploring data. You can use command-line options to customize the Julia environment, specify files to execute, and control the execution behavior. For complex analyses, it's advisable to put all your code into a julia file, and execute it instead of using the REPL. By default, julia will execute a precompiled standard library and all user packages, so the first run might take longer to compile the code. Subsequent runs are much faster.

CAVEATS

The startup time of Julia can be longer than other scripting languages due to JIT compilation. This can be mitigated with precompilation of commonly used packages and base library.

ENVIRONMENT VARIABLES

JULIA_LOAD_PATH: Specifies a list of directories to search for Julia source files and packages.
JULIA_DEPOT_PATH: Specifies the locations where Julia stores package information and artifacts.
JULIA_NUM_THREADS: sets the number of threads Julia can use.

EXIT CODES

Julia returns a 0 exit code on successful completion. A non-zero exit code indicates an error occurred during execution.

HISTORY

Julia was first released in 2012.
It was designed by Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman, who set out to create a language that was both high-level and fast.
The goal was to address the need for a single environment capable of high-performance numerical computing, eliminating the need to switch between languages like Python/MATLAB for prototyping and C/Fortran for performance.

SEE ALSO

python(1), R(1), gdb(1)

Copied to clipboard