Starting the REPL
Launch Nash in interactive mode by running it without arguments:Setting a Custom Username
Use the-U or --user flag to set the session username. This creates a matching home directory and sets all Unix environment variables accordingly:
The username affects
$USER, $LOGNAME, $HOME, and creates /home/<username> with Desktop/, Documents/, and Downloads/ subdirectories in the VFS.Prompt Structure
The Nash prompt follows the classic bash format:- username: The session username (set via
-U, default:user) - cwd: Current working directory (absolute VFS path)
- sigil:
$for regular users,#for root
- Regular User
- Root User
Command History
Nash usesrustyline for full readline support with command history:
Navigation
- ↑/↓ arrows: Navigate through previous commands
- Ctrl+R: Reverse search through history
- Tab: Filename completion (if available)
Viewing History
Use thehistory builtin to view all executed commands:
History is stored in memory and persists throughout the session. It resets when you exit Nash.
Keyboard Shortcuts
Ctrl-C: Interrupt
PressCtrl+C to cancel the current input line without executing it:
^C is printed and you get a fresh prompt.
Ctrl-D: Exit
PressCtrl+D on an empty line to gracefully exit the REPL:
exit or quit.
Exiting the Shell
All three methods exit cleanly:Interactive Flags
Force Interactive Mode
Use-i to force interactive mode even when stdin is not a TTY:
Starting in a Specific Directory
Use-C or --cwd to override the initial directory:
Combining Flags
Real-World Examples
Basic Session
Using Pipes and Redirections
Multi-User Development
Interactive Detection
Nash automatically detects whether stdin is a TTY. The execution mode follows this priority:-c CMD→ one-shot command-s→ read from stdinSCRIPT→ run script file-i→ forced interactive- stdin is TTY → interactive REPL (default)
- stdin is pipe → read from stdin
See Also
- Script Execution - Running Nash scripts
- CLI Flags - Complete flag reference
- RC Files - Customizing your Nash environment
