railway shell
Open a new shell session with environment variables from your Railway service available.
Usage
railway shell [OPTIONS]Options
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service to pull variables from (defaults to linked service) |
--silent | Open shell without banner |
Examples
Open shell with variables
railway shellOutput:
Entering subshell with Railway variables available. Type 'exit' to exit.Shell for specific service
railway shell --service backendSilent mode
railway shell --silentHow it works
- Fetches environment variables from the specified Railway service
- Opens a new shell with those variables in the environment
- Sets
IN_RAILWAY_SHELL=trueto indicate you're in a Railway shell
Type exit to leave the shell and return to your normal environment.
Shell detection
On Windows, the CLI detects your current shell (PowerShell, cmd, pwsh) and opens the same type. On Unix systems, it uses the $SHELL environment variable.
Difference from
- shell: Opens an interactive shell session
- run: Executes a single command and exits