A lightweight, feature-rich command shell written in C. NovaShell provides a modern terminal experience with built-in commands, environment variable management, script execution, and more.
- Built-in Commands: Essential shell commands including
cd,pwd,echo,export,clear, andhelp - Environment Variable Management: Full support for setting, exporting, and expanding environment variables
- Script Execution: Execute shell scripts (.sh files) and any executable with shebang
- Command History: Persistent command history with up/down arrow navigation
- Tab Completion: Auto-completion for built-in commands
- Colorful Interface: Beautiful color-coded output with customizable themes
- Cross-Platform: Built on standard C libraries for wide compatibility
- GCC compiler
- Standard C libraries (unistd.h, stdlib.h, etc.)
- Make (optional, for building)
- Clone or download the NovaShell source code
- Navigate to the project directory
- Compile the shell:
make compileOr manually:
gcc -Wall -Wextra src/main.c src/utils.c src/linenoise.c -o nsh -Isrc/libs- Run NovaShell:
./nshStart NovaShell by running the compiled binary:
./nshYou'll see the NovaShell prompt:
nsh — Nova Shell
nsh v1.0.0
Type `help` to show available commands!
nsh $
Exit the shell.
nsh $ exitPrint the current working directory.
nsh $ pwd
/home/user/projectsChange the current directory.
nsh $ cd /path/to/directory
nsh $ cd .. # Go up one directory
nsh $ cd # Go to home directoryPrint text to the terminal with variable expansion support.
nsh $ echo "Hello, World!"
Hello, World!
nsh $ echo "Current user: $USER"
Current user: username
nsh $ echo "Home directory: ${HOME}"
Home directory: /home/usernameManage environment variables.
# Set a new variable
nsh $ export MY_VAR=hello
# Export an existing variable
nsh $ export PATH
# List all environment variables
nsh $ export
declare -x HOME=/home/user
declare -x PATH=/usr/bin:/bin
declare -x MY_VAR=helloClear the terminal screen.
nsh $ clearShow help information for all built-in commands.
nsh $ help
exit Exit the shell
pwd Print current working directory
cd <directory> Change directory
export List all environment variables
export VAR=value Set and export environment variable
export VAR Export existing variable
echo [text] Print text (supports $VAR expansion)
clear Clear the screen
help Show this help messageNovaShell can execute shell scripts in two ways:
Run a script file directly:
nsh $ ./myscript.sh
nsh $ ./myscript.sh arg1 arg2Execute a script as the first argument to NovaShell:
nsh $ ./nsh myscript.sh
nsh $ ./nsh myscript.sh arg1 arg2NovaShell supports full environment variable management:
nsh $ export MY_VAR=value
nsh $ export PATH=/usr/local/bin:$PATHnsh $ echo "User: $USER, Home: $HOME"
User: username, Home: /home/username
nsh $ echo "Full path: ${HOME}/Documents"
Full path: /home/username/DocumentsNovaShell maintains a persistent command history:
- Use up/down arrow keys to navigate through previous commands
- History is saved to
history.txtin the current directory - History is loaded automatically when NovaShell starts
NovaShell provides tab completion for built-in commands:
- Type the beginning of a command and press Tab
- Available completions will be shown
- Works for all built-in commands:
exit,cd,echo,export,clear,help,pwd
NovaShell uses a carefully designed color scheme:
- Prompt/Commands: Bright cyan (
#64C8FF) - Regular Output: Light gray/white (
#E6E6E6) - Success Messages: Bright green (
#64FF64) - Warnings: Bright yellow/orange (
#FFC864) - Errors: Bright red (
#FF6464) - Info Text: Soft blue (
#96C8FF)
NovaShell/
├── src/
│ ├── main.c # Main shell implementation
│ ├── utils.c # Utility functions and command handlers
│ ├── linenoise.c # Line editing library
│ └── libs/
│ ├── utils.h # Header file with function declarations
│ └── linenoise.h # Line editing library header
├── Makefile # Build configuration
├── README.md # This documentation file
├── LICENSE # GNU GPLv3 license
└── THIRD_PARTY_LICENSES.txt # Third-party license information
make compile # Compile the shell
make clean # Remove compiled binary
make run # Compile and runTo add new built-in commands:
- Add the command name to the
commandsarray incompletion()function inutils.c - Add command handling logic in the main loop in
main.c - Update the help text in the
helpcommand
Contributions are welcome! Please follow these guidelines:
- Maintain the existing code style
- Add appropriate error handling
- Update documentation for new features
- Test thoroughly before submitting
NovaShell is my own code and is licensed under the GNU GPLv3 (see LICENSE).
NovaShell uses the following third-party libraries:
- linenoise (BSD 2-Clause License)
Full license text included in THIRD_PARTY_LICENSES.txt
If you redistribute NovaShell or its binaries, please preserve all copyright notices and license texts for third-party libraries.