Gosh is a feature-rich, modern shell implementation written in Go that combines the familiarity of bash with modern conveniences and performance.
- 🚀 Fast and Lightweight: Built in Go for excellent performance
- 🔧 Bash-Compatible: Supports familiar bash syntax and features
- 📝 Smart Tab Completion: Intelligent completion for commands, files, directories, and git operations
- 🎨 Customizable Prompts: Rich prompt system with git integration and color schemes
- 📁 Configuration Files: Support for
.goshrc
and.gosh_profile
- 🔀 Git Integration: Built-in git status, branch information, and git-aware completion
- 📚 Command History: Persistent history with search capabilities and arrow key navigation
- 🛠️ Built-in Commands: Essential commands like cd, pwd, exit, help, history, alias, export
- ⚡ Interactive Features: Proper Ctrl+C handling, variable expansion ($VAR), and error recovery
- 🔍 Smart Error Handling: Helpful error messages with command suggestions
# Clone the repository
git clone https://github.com/yourusername/gosh.git
cd gosh
# Build and install
make install
# Start gosh
gosh
# Or run directly from repository (for development)
make run
# Or run the setup script for first-time configuration
./setup.sh
Gosh provides a rich interactive experience:
-
Tab Completion: Press Tab to complete commands, files, and git operations
git che<Tab>
→git checkout
cd /ho<Tab>
→cd /home/
h<Tab>
→ showshelp
andhistory
-
Command History: Use arrow keys to navigate through command history
↑
/↓
to browse previous/next commands- Persistent history across sessions
-
Variable Expansion: Use environment variables in commands
echo $HOME
→ shows your home directoryexport MY_VAR=value
thenecho $MY_VAR
→ showsvalue
-
Ctrl+C Handling: Properly interrupts commands and returns to prompt
-
Smart Error Messages: Get helpful suggestions when commands fail
xit
→ "Did you mean: exit?"
Gosh supports two configuration files:
.gosh_profile
: Executed once at login (like.bash_profile
).goshrc
: Executed for each interactive shell (like.bashrc
)
# ~/.goshrc
export GOSH_PROMPT_FORMAT="%u@%h:%w%g$ "
export GOSH_HISTORY_SIZE=10000
alias ll="ls -la"
alias grep="grep --color=auto"
cd
- Change directorypwd
- Print working directoryexit
- Exit the shellhelp
- Show help informationhistory
- Show command historyalias
- Create command aliasesexport
- Set environment variables
Gosh provides seamless git integration:
- Current branch displayed in prompt
- Git status indicators (clean, dirty, ahead/behind)
- Tab completion for git commands and branches
- Git-aware directory navigation
make build # Build the binary
make test # Run tests
make clean # Clean build artifacts
make install # Install to system
gosh/
├── cmd/ # Command-line interface
├── internal/ # Internal packages
│ ├── shell/ # Core shell logic
│ ├── parser/ # Command parsing
│ ├── completion/# Tab completion
│ ├── prompt/ # Prompt system
│ ├── config/ # Configuration management
│ ├── git/ # Git integration
│ └── history/ # History management
├── docs/ # Documentation
├── scripts/ # Setup and utility scripts
└── Makefile # Build system
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
Inspired by bash, zsh, and fish shells, built with modern Go practices.