Introduction
rsshell is a simple Unix shell written in Rust. It provides an interactive command-line interface with common shell features like pipes, aliases, environment variable expansion, glob patterns, and command history.
Features
- Interactive REPL with line editing (rustyline)
- Command history with persistence
- Pipes (
cmd1 | cmd2 | cmd3) - Built-in commands:
cd,pwd,echo,export,unset,source,type,history,exit - Alias expansion
- Environment variable expansion (
$VAR,${VAR}) - Tilde expansion (
~/path) - Glob pattern expansion (
*.txt,src/**/*.rs) - Quoting (single and double quotes)
- Escape sequences
- TOML-based configuration
- Shell completions generation
Tech Stack
- Language: Rust (edition 2024)
- CLI: clap with derive macros
- Line editing: rustyline
- Configuration: TOML via serde
- Unix APIs: nix crate
- Glob expansion: glob crate
Installation
Install from crates.io
cargo install rsshell
This downloads, compiles, and installs the latest published version into ~/.cargo/bin/.
From source
git clone https://github.com/veltzer/rsshell.git
cd rsshell
cargo build --release
The binary will be at target/release/rsshell.
From GitHub Releases
Download pre-built binaries from the Releases page. Available for Linux (x86_64, aarch64).
Getting Started
Running the shell
# Start interactive shell
rsshell
# Run a single command
rsshell -c "echo hello world"
# Initialize config file
rsshell init-config
# Show version info
rsshell version
First steps
- Run
rsshell init-configto create a default config at~/.config/rsshell/config.toml - Edit the config to set up aliases and environment variables
- Run
rsshellto start the interactive shell
Features
Built-in commands
| Command | Description |
|---|---|
cd [dir] | Change directory (defaults to home) |
pwd | Print working directory |
echo [args...] | Print arguments |
export VAR=value | Set environment variable |
unset VAR | Remove environment variable |
source file | Execute commands from file |
type cmd | Show command type (builtin or path) |
history | Show command history |
exit [code] | Exit the shell |
Pipes
Commands can be piped together:
ls -la | grep ".rs" | sort
cat file.txt | wc -l
Aliases
Define aliases in your config file:
[aliases]
ll = "ls -la"
gs = "git status"
Variable expansion
export NAME=world
echo "hello $NAME"
echo "path is ${HOME}/bin"
Glob expansion
ls *.txt
cat src/**/*.rs
Configuration
rsshell uses a TOML configuration file located at ~/.config/rsshell/config.toml.
Run rsshell init-config to generate a default config file.
Sections
[prompt]
The prompt is built from an ordered list of parts. Each part has a text and optional styling.
[prompt]
show_exit_code = true
exit_code_color = "red"
[[prompt.parts]]
text = "{user}"
color = "green"
[[prompt.parts]]
text = "@"
[[prompt.parts]]
text = "{host}"
color = "green"
[[prompt.parts]]
text = ":"
[[prompt.parts]]
text = "{cwd}"
color = "blue"
bold = true
[[prompt.parts]]
text = "$ "
Variables
| Variable | Description |
|---|---|
{user} | Current username |
{host} | Hostname |
{cwd} | Current working directory (~ for home) |
{cwd_basename} | Basename of current directory |
{git_branch} | Current git branch (empty if not in a repo) |
{git_dirty} | dirty or clean (empty if not in a repo) |
{git_status} | * if dirty, empty if clean or not in a repo |
{git_sha} | Full git commit SHA |
{git_sha_short} | Short git commit SHA |
{git_repo} | Git repository name |
{date} | Current date (YYYY-MM-DD) |
{time} | Current time (HH:MM:SS) |
{shell} | Shell name (rsshell) |
{newline} | A newline character |
{$} | A literal $ |
Colors
Standard: black, red, green, yellow, blue, magenta, cyan, white
Bright: bright_black (also gray/grey), bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white
Use none (default) for no color.
Both color (foreground) and bg (background) accept any of the above.
Styles
| Style | Description |
|---|---|
bold = true | Bold text |
dim = true | Dimmed text |
italic = true | Italic text |
underline = true | Underlined text |
strikethrough = true | Strikethrough text |
When show_exit_code is true, non-zero exit codes are shown as [code] before the prompt in the configured exit_code_color.
Example: prompt with git branch and dirty indicator
[[prompt.parts]]
text = "{user}"
color = "green"
[[prompt.parts]]
text = " "
[[prompt.parts]]
text = "{cwd}"
color = "blue"
bold = true
[[prompt.parts]]
text = " ({git_branch}{git_status})"
color = "yellow"
[[prompt.parts]]
text = "{newline}{$} "
Example: two-line prompt with date
[[prompt.parts]]
text = "[{date} {time}] "
color = "gray"
dim = true
[[prompt.parts]]
text = "{user}@{host}"
color = "green"
[[prompt.parts]]
text = ":"
[[prompt.parts]]
text = "{cwd}"
color = "bright_blue"
bold = true
[[prompt.parts]]
text = "{newline}{$} "
[aliases]
[aliases]
ll = "ls -la"
la = "ls -A"
gs = "git status"
[env]
Environment variables set at shell startup:
[env]
EDITOR = "vim"
[startup]
Commands to run when the shell starts:
[startup]
commands = ["echo 'Welcome to rsshell!'"]
Platform Limitations
rsshell is designed as a Unix shell and currently only compiles and runs on Linux (macOS is no longer supported). This page documents all the issues that prevent Windows compilation.
Summary
| Category | Count | Severity |
|---|---|---|
| Unix-only crate dependency | 1 | Blocker |
| Unix system calls | 1 | Blocker |
| Unix signal handling | 2 | Blocker |
| Unix-specific imports | 1 | Blocker |
| PATH separator assumptions | 1 | Runtime bug |
| Path separator assumptions | 3 | Runtime bug |
Unix date command usage | 2 | Runtime failure |
Detailed Issues
1. The nix crate (Blocker)
File: Cargo.toml
nix = { version = "0.29", features = ["signal", "process", "fs", "hostname"] }
The nix crate provides Rust-friendly bindings to Unix system APIs. It does not compile on Windows at all. It is used for:
- Getting the system hostname via
gethostname()
Possible fix: Replace with the hostname crate or use std::env::var("COMPUTERNAME") on Windows.
2. std::os::unix import (Blocker)
File: src/commands.rs
#![allow(unused)]
fn main() {
use std::os::unix::process::ExitStatusExt;
}
The std::os::unix module does not exist on Windows. The ExitStatusExt trait provides the .signal() method used to detect if a process was killed by a signal.
Possible fix: Use #[cfg(unix)] conditional compilation and provide a Windows fallback using std::os::windows::process::ExitStatusExt.
3. Unix signal handling (Blocker)
File: src/commands.rs (two locations)
#![allow(unused)]
fn main() {
// In execute_pipeline()
status.signal().map(|s| 128 + s).unwrap_or(1)
// In cmd_external()
status.signal().map(|s| 128 + s).unwrap_or(1)
}
Unix processes can be terminated by signals (SIGTERM, SIGKILL, etc.), and the convention is to report exit code 128 + signal_number. Windows does not have Unix signals.
Possible fix: Wrap in #[cfg(unix)] and use a simpler fallback on Windows (e.g., just return the exit code or 1).
4. gethostname() system call
File: src/helpers.rs
#![allow(unused)]
fn main() {
nix::unistd::gethostname()
}
This is a POSIX system call not available on Windows.
Possible fix: Use the cross-platform hostname crate, or std::env::var("COMPUTERNAME") on Windows.
5. PATH separator hardcoded as :
File: src/commands.rs
#![allow(unused)]
fn main() {
for dir in path_var.split(':') {
}
Unix uses : to separate entries in $PATH, while Windows uses ;. This would cause the type builtin to fail to find any commands on Windows.
Possible fix: Use std::env::split_paths() which handles this cross-platform.
6. Forward slash as path separator
File: src/helpers.rs (multiple locations)
#![allow(unused)]
fn main() {
// Extracting cwd basename
let cwd_basename = cwd.rsplit('/').next().unwrap_or(&cwd).to_owned();
// Extracting git repo name
.rsplit('/')
}
These assume / as the path separator. On Windows, paths use \.
Possible fix: Use std::path::Path::file_name() or std::path::MAIN_SEPARATOR.
7. Unix date command
File: src/helpers.rs and build.rs
#![allow(unused)]
fn main() {
Command::new("date").arg("+%Y-%m-%d %H:%M:%S")
}
The date command with + format specifiers is Unix-specific. Windows does not have this command.
Possible fix: Use the chrono crate for cross-platform date/time formatting, or use std::time::SystemTime with manual formatting.
8. Git path references in build.rs
File: build.rs
#![allow(unused)]
fn main() {
println!("cargo:rerun-if-changed=.git/HEAD");
std::fs::read_to_string(".git/HEAD")
let loose = format!(".git/{refpath}");
}
While forward slashes generally work on Windows for file access, these hardcoded paths may fail with non-standard git configurations (e.g., git worktrees, GIT_DIR).
Possible fix: Use std::path::PathBuf to construct paths portably.
Why Not Fix These?
rsshell is fundamentally a Unix shell — it spawns Unix processes, uses Unix pipes, and implements Unix shell semantics. While the compilation blockers above could be fixed with conditional compilation, the shell itself would have limited usefulness on Windows since:
- The built-in commands (
cd,pwd,source, etc.) follow Unix conventions - External command execution assumes Unix process semantics
- Pipeline implementation uses Unix pipe mechanisms
- Users on Windows who want a Unix-like shell experience typically use WSL, Git Bash, or similar environments
For these reasons, the Windows target has been intentionally removed from the release workflow.
Release Info
This page is generated automatically by the docs deployment workflow.
- Version:
0.1.11 - Git tag:
v0.1.11 - Git commit:
9b4c88bcfb29c1f73269ef08ff6283654b8f5e5a - Released at:
2026-11-21 08:15:10 UTC - Workflow:
CIrun #87