You need the CLI installed and signed in and a
selected workspace where you have the admin or editor role.
Use the demo computer from Create a computer, with an
image that includes sh.
Check the computer
nevia status demoThe state must be ready, with no pending transition. If the computer is sleeping,
wake it first. Shell does not wake a computer.
Open the shell
nevia shell demoNevia runs the image's SHELL, or /bin/sh when the image sets none, and allocates a
terminal for you. Type a few commands:
echo hello
pwdYou see hello and the working directory inside the computer. Run exit to close the
shell and return to your local terminal. The CLI exits with the shell's status.
The shell runs with the image ENTRYPOINT cleared, so it starts the same way on an
image whose ENTRYPOINT is an application rather than a shell. To run the image's own
command, or another program, use nevia exec.
Run commands from a script
nevia shell needs a terminal on both stdin and stdout, and refuses to start without
one, since a shell is an interactive session by definition. For commands from a pipe or a script, use nevia exec, which
streams stdin with -i:
printf 'uname -a
id
' | nevia exec demo -i --entrypoint '' -- shOr run one command directly:
nevia exec demo --entrypoint '' -- sh -c 'uname -a; id'Set environment variables
The shell gets the computer's stored env, with secrets and variables at their current
values. Add -e KEY=value to set or override a variable for this shell only:
nevia shell demo -e LOG_LEVEL=debugUse -e secrets.NAME or -e variables.NAME to take a value from the workspace. For the
full rules, see Computer environment variables.
Session lifetime
Each shell is a session with its own URL. See Interactive sessions for what a session URL can reach.
Sessions expire after one hour. Set another duration, up to 12 hours, with --ttl:
nevia shell demo --ttl 2hA shell cut at its expiry reports the TTL it ran with. Closing the terminal does not stop a process the shell left running in the computer.
nevia shell lists the command options.