A C++ implementation of a Linux shell that is lightweight and customizable. linux-shell provides a familiar command-line interface with support for command history, aliases, and common built-in commands.
- Command Execution: Run any standard Linux programs and commands
- Built-in Commands:
cd
: Change directorypwd
: Print working directoryecho
: Display texthistory
: View command historyalias
/unalias
: Create and manage command aliasesexit
: Exit the shell
- Command History: Persistent history between sessions with support for history navigation
- Tab Completion: File and command tab completion
- Aliases: Define custom command shortcuts that persist between sessions
- Signal Handling: Properly handles Ctrl+C (SIGINT) and Ctrl+Z (SIGTSTP)
- Multiline Commands: Support for command continuation with backslash
- A C++ compiler with C++11 support
- CMake (version 3.10 or later)
- Readline development library
On Debian/Ubuntu:
sudo apt-get install build-essential cmake libreadline-dev
On Arch Linux:
sudo pacman -S base-devel cmake readline
On Red Hat/Fedora:
sudo dnf install gcc-c++ cmake readline-devel
Clone the repository:
git clone https://github.com/isaiah76/linux-shell.git
cd linux-shell
You have two options to build and install:
- Make the script executable:
chmod +x build_install.sh
- Run the script:
./build_install.sh
- Create a build directory, configure and build the project:
mkdir build
cd build
cmake ..
make
- To install the shell system-wide (the binary will be installed to /usr/local/bin):
sudo make install
After installation, launch the shell by typing:
linux-shell
Command history is automatically saved to ~/.linux_shell_history
and loaded when the shell starts.
- Use the up and down arrow keys to navigate through command history.
- View history with the
history
command:
history # Show all history
history 10 # Show the last 10 commands
Create an alias:
alias ll='ls -la'
alias gs='git status'
View all aliases:
alias ll='ls -la'
alias gs='git status'
View a specific alias:
alias ll
Remove an alias:
unalias ll
Aliases are automatically saved to ~/.linux_shell_aliases
and loaded when the shell starts.