Skip to content

onihilist/NShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

92 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

NShellBanner

A custom C# interactive shell, customizable.

NShell Preview


🧠 What is NShell?

NShell is a lightweight, extensible shell written in C# using [.NET 8.0+].
It's designed for hackers, shell lovers, and those who enjoy boot sequences.


✨ Features

  • βœ… Custom interactive shell interface
  • βœ… Built-in command loader with registration system
  • βœ… Command metadata (Description, IsInteractive, RequiresRoot, etc.)
  • βœ… Handle customs commands, but load also /usr/bin, /usr/sbin..ect commands.
  • βœ… Spectre.Console markup support for colors, glitches, animations
  • βœ… Full AOT support (with manual command registration)
  • βœ… Future-proof extensibility (plugin-style architecture)
  • βœ… Tab completion for commands and file paths
  • βœ… Command history with Ctrl+R reverse search
  • βœ… Command aliases (alias/unalias)
  • βœ… Environment variable management (export/unset/printenv)
  • βœ… Word-based cursor navigation (Ctrl+Left/Right)
  • βœ… Rich built-in commands (help, history, which, pwd, echo, clear, exit)
  • βœ… Output redirection (>, >>)
  • βœ… Command chaining (&&, ||, ;)
  • βœ… Basic piping support (|)

πŸš€ Installation

Clone the repo and install:

git clone https://github.com/onihilist/NShell.git
cd NShell
chmod +x install.sh
./install.sh

🎨 Custom themes

This is a little exemple of an custom theme.
If you are using format_top/bottom & corner_top/bottom, format will be ignored.
For making a single line prompt use format, and double line format_top/bottom.
N.B : path_slash_color & path_words_color works with single and double line shell prompt. Exemple :

{
  "name": "test",
  "format": "[bold green][[{user}@{host}]][/][white][[{cwd}]] >>[/]",
  "format_top": "[[[bold cyan]{user}[/]@[bold cyan]{host}[/]]]",
  "format_bottom": "[[{cwd}]]",
  "corner_top": "[bold magenta]\u250c[/]",
  "corner_bottom": "[bold magenta]\u2514[/]",
  "ls_colors": "di=34:fi=37:ln=36:pi=33:so=35:ex=32",
  "path_slash_color": "cyan",
  "path_words_color": "yellow"
}

The name of the theme is test, no matter what the file is named.
So enter the command : settheme test.
This is the result :

Preview Test Theme


βš™οΈ Plugin(s)

Since version 0.5.0, you can build your own plugin (DLL) and add this to NShell. This is a simple exemple :

using NShell.Shell.Commands;
using NShell.Shell;
using Spectre.Console;

namespace HelloPlugin
{
    public class HelloPlugin : ICustomCommand
    {
        public string Name => "hello";

        public HelloPlugin()
        {
            CommandRegistry.Register(this);
        }

        public void Execute(ShellContext context, string[] args)
        {
            AnsiConsole.MarkupLine("[green]Hello from HelloPlugin![/]");
        }
    }
}

And DON'T FORGET TO USE THE SAME IMPORTS AS NSHELL ! With the same version of Spectre.Console (0.50.0)

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <ImplicitUsings>enable</ImplicitUsings>
  <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
  <ProjectReference Include="../NShell/NShell.csproj"/>
  <PackageReference Include="Spectre.Console" Version="0.50.0" />
</ItemGroup>
</Project>

πŸ“‘ Roadmap v1.0.0

  • [PROGRESS] Plugin support (dynamic loading)
  • [OK] Fix neofetch shell version
  • [OK] Fix interactive commands/scripts running configuration
  • [OK] Autocomplete
  • [OK] Command history
  • [OK] Profiles and theme switching
  • [OK] Remove Bash FallBack
  • [OK] Themes & ThemeLoader

πŸ”¨ Built-in Commands

NShell comes with a rich set of built-in commands:

Command Description
help Display all available commands with descriptions
about Display information about NShell
exit Exit the shell gracefully
clear Clear the terminal screen
cd <dir> Change directory
pwd Print current working directory
echo <text> Display text (supports variable expansion)
history [n] Show command history (optionally last n commands)
alias name='cmd' Create command alias (persisted across sessions)
unalias name Remove command alias
export VAR=value Set environment variable
unset VAR Remove environment variable
printenv [VAR] Print environment variables
which <cmd> Show path to command
settheme <name> Change shell theme

Keyboard Shortcuts:

  • Tab - Auto-complete commands and paths
  • Ctrl+R - Reverse history search
  • Ctrl+A / Home - Move cursor to start of line
  • Ctrl+E / End - Move cursor to end of line
  • Ctrl+Left/Right - Move cursor by word
  • Up/Down - Navigate command history

Advanced Shell Features:

  • Command chaining with && (run if previous succeeded), || (run if previous failed), and ; (always run)
  • Output redirection with > (overwrite) and >> (append)
  • Basic piping with | (pipe output between commands)
  • Smart command suggestions with "Did you mean...?" for typos
  • Persistent aliases (saved in ~/.nshell/nshellrc.json)

Examples:

# Chain commands
echo "Building..." && dotnet build && echo "Success!" || echo "Failed!"

# Redirect output
echo "Hello World" > output.txt
history 50 >> history.log

# Use aliases (persisted across sessions)
alias ll='ls -la'
ll

# Environment variables
export MY_VAR="Hello"
echo {MY_VAR}

# Fast startup
nshell --no-banner

πŸ”§ Troubleshooting

If you have any problem with NShell, or it locks you out of a proper shell,
you can forcefully switch back to bash like this:

sudo sed -i "s|/usr/local/bin/nshell|/bin/bash|" /etc/passwd

If you got the error "bad interpreter" when running install.sh try to run this :

sudo apt update
sudo apt install dos2unix
dos2unix install.sh

About

A C# interactive and customizable shell.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published