A lightweight, intuitive directory bookmarking system for bash and zsh that helps you navigate your filesystem with ease.
- 📌 Named Bookmarks - Save directories with memorable names
- 🔢 Numbered Bookmarks - Quick access with numbers (1-15) for temporary bookmarks
- 🚀 Ultra-fast Navigation - Shortcuts
g1throughg9for instant access - 📝 Smart Tab Completion - See all bookmarks with paths before jumping
- 🔗 Path Variables - Access all bookmarks as shell variables (
$g1-$g15, plus the named bookmarks) - 💾 Persistent Storage - Bookmarks survive shell restarts
- 🎯 Zero Dependencies - Pure shell script, no external tools needed
- 📊 Clean Formatting - Formatted output, easy to scan
- Clone or download
goto.shto your preferred location:
git clone https://github.com/nkanellopoulos/goto.git ~/goto- Add to your shell configuration:
For bash (~/.bashrc):
source ~/goto/goto.shFor zsh (~/.zshrc):
source ~/goto/goto.sh- Reload your shell or run:
source ~/.bashrc # or ~/.zshrc| Command | Description |
|---|---|
mk |
Bookmark current directory |
mk <name> |
Bookmark current directory with a name |
gt |
List all bookmarks |
gt <number> |
Go to bookmark by number |
gt <name> |
Go to bookmark by name |
g1...g9 |
Quick shortcuts for bookmarks 1-9 |
ml |
List all bookmarks (alias for gt) |
mkr <number/name> |
Remove a bookmark |
mkc |
Clear all bookmarks |
# Navigate to your projects directory
cd ~/Projects/my-awesome-project
# Bookmark it with a name
mk awesome
✓ Marked 'awesome'
# Go to your downloads folder and bookmark it
cd ~/Downloads
mk
✓ Marked
# See all your bookmarks
gt
1 awesome ~/Projects/my-awesome-project
2 ---------- ~/Downloads
# Jump using the name
gt awesome
/Users/you/Projects/my-awesome-project
# Or use the number
gt 2
/Users/you/Downloads
# Even faster with shortcuts
g1 # Goes to bookmark 1 instantly
# Tab completion shows your bookmarks
gt <TAB>
1 awesome ~/Projects/my-awesome-project
2 ---------- ~/Downloads# Bookmark with spaces in names (use quotes)
mk "client work"
# Update an existing bookmark name
cd /new/path
mk awesome # Updates the 'awesome' bookmark to current directory
✓ Updated 'awesome'
# Remove bookmarks
mkr awesome # Remove by name
mkr 2 # Remove by number
✓ Removed
# If you try to bookmark the same directory twice
mk
Already bookmarked: 3) ~/Projects/my-awesome-project
# Use bookmark paths in other commands
echo $g1 # Prints the path of bookmark 1
cp file.txt $g2/ # Copy file to bookmark 2
ls -la $g3 # List contents of bookmark 3
# Named bookmarks are also available as variables
echo $awesome # Prints the path of the 'awesome' bookmark
cd $awesome/subdir # Navigate to subdirectory of named bookmark
diff $frontend/app.js $backend/server.js # Compare files across bookmarks-
Project Organization - Bookmark your active projects:
mk frontend mk backend mk docs
-
Quick Switching - Use
g1,g2, etc. for your most-used directories -
Temporary Bookmarks - Use numbers for temporary bookmarks, names for permanent ones
-
Manual Organization - You can carefully edit
~/.goto_bookmarksto reorganize your bookmarks' order
You can add the current bookmark name to your shell prompt. You can either copy the function from prompt_integration.sh or source it directly:
# Add this to your .bashrc or .zshrc
source ~/goto/prompt_integration.shThen modify your prompt:
For bash:
PS1='$(_get_bookmark_name)\u@\h:\w\$ 'For zsh:
setopt PROMPT_SUBST
PROMPT='$(_get_bookmark_name)%n@%m:%~%# 'This will show [awesome] when you're in a named bookmark, [2] for unnamed bookmarks (showing the bookmark number), or nothing if not bookmarked.
Note: If you have an existing custom prompt, you can prepend the bookmark indicator:
# For bash
PS1='$(_get_bookmark_name)'$PS1
# For zsh
PROMPT='$(_get_bookmark_name)'$PROMPTBookmarks are stored in ~/.goto_bookmarks as a simple text file. Format:
name|/full/path/to/directory
|/path/without/name
- ✅ bash 4.0+
- ✅ zsh 5.0+
- ✅ macOS Terminal, iTerm2
- ✅ Linux All distributions
- ✅ WSL Windows Subsystem for Linux
MIT License - feel free to use in personal and commercial projects.
- Memory - No need to remember long paths
- Speed - Jump anywhere in 2-3 keystrokes
- Persistence - Bookmarks survive terminal restarts
- Named References - Use meaningful names, not just stack positions
- Persistence - Stack doesn't survive shell exit
- Visibility - See all bookmarks at once
- Explicit Control - Bookmark exactly what you want
- Names - Reference by meaningful names
- Portability - Works the same everywhere
- Predictable - No surprises from frequency-based algorithms
- Immediate - Works right after bookmarking, no "learning" period
- Transparent - You control what's bookmarked
Contributions are welcome! Feel free to submit issues and enhancement requests.
Nikos Kanellopoulos
Created with frustration from typing long paths too many times. 🚀
