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.