Smart PATH management toolkit for Fish Shell.
Managing your $PATH can be tedious and error-prone. Duplicate entries, invalid directories, or forgotten modifications can break scripts or slow down your terminal startup.
pathtoolkit.fish provides a comprehensive set of commands to view, clean, modify, backup, and restore your PATH environment in Fish Shell — all safely and interactively.
It helps you keep your PATH clean, consistent, and reversible without manually editing config files.
- 🌐 Pretty-print
$PATHentries with indices - ⚠ Detect duplicate PATH entries
- ❌ Detect invalid/non-existent directories
- 🧪 Dry-run PATH cleaning
- ✅ Apply PATH cleaning and remove duplicates
- 🗑 Remove specific PATH entries
- 💾 Backup and restore PATH
- ⏪ Undo previous PATH modifications
- 🐚 Fully native Fish Shell script, no dependencies
- 🔁 Interactive menu for easy PATH management
- 💡 Tips and hints embedded for safer usage
- Fish Shell v3.0+
- Unix-like environment (Linux/macOS)
Install with Fisher:
fisher install demartini/pathtoolkit.fishLaunch the interactive PATH management menu:
path_toolkitSample interactive menu:
===============================
Fish PATH Toolkit Interactive
===============================
Last actions:
1) clean PATH applied
2) removed: /home/user/old_bin
1) Print PATH nicely
2) Check duplicate/invalid PATH entries
3) Dry-run clean
4) Apply clean
5) Remove PATH entry
6) Backup current PATH
7) Restore PATH from backup
8) Undo modifications
9) Exit
Enter a number (1-9):💡 Tip: After executing a command, press
Enterto return to the menu.
| Command | Description |
|---|---|
path_toolkit |
Open interactive menu |
path_toolkit --pretty |
Print PATH nicely |
path_toolkit --check-duplicates |
Check duplicate/invalid PATH entries |
path_toolkit --clean |
Dry-run clean |
path_toolkit --clean-apply |
Apply clean |
path_toolkit --remove <path> |
Remove PATH entry |
path_toolkit --backup |
Backup current PATH |
path_toolkit --restore |
Restore PATH from backup |
path_toolkit --undo |
Undo modifications |
path_toolkit --help |
Show this help |
path_toolkit --version |
Print version information |
💡 Tip: You can also use an alias
ptkforpath_toolkit.
🌐 PATH entries:
1. /usr/local/bin
2. /usr/bin
3. /bin
🧑💻 fish_user_paths entries:
1. /home/user/.local/bin
⚠ Found 1 duplicate PATH entries:
1. /usr/local/bin
✗ Found 1 invalid directories:
1. /home/user/old_bin
🧪 Dry-run mode — showing what would change:
Old PATH:
/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/home/user/old_bin
New PATH:
/usr/local/bin:/usr/bin:/bin
✔ PATH cleaned successfully.If you want to help, check our contribution guidelines and open an issue or pull request.
See CHANGELOG for a human-readable history of changes.
Distributed under the MIT License. See LICENSE for more information.