Making upward navigation in symlinks intuitive and maintainable.
Breadcrumbs offer a simpler way to move up in directory hierarchies by using symbolic links with easy-to-understand "breadcrumbs" markers. This replaces the confusing ../ sequences, making it easier to track and manage paths.
Consider the following directory structure:
project/
β
ββββ module1/
β    ββββ sub1/
β         ββββ file1.txt
β
ββββ module2/
     ββββ sub2/
With the usual method, to create a symlink inside sub2 to file1.txt, we run:
ln -s ../../module1/sub1/file1.txtProblems:
- Obscurity: Multiple 
../sequences can be hard to decipher, especially in deeper directory structures. - Maintenance: When restructuring directories, updating numerous symlinks becomes tedious.
 - Brittleness: Modifying the directory structure can not only break links, but may also unintentionally reference existing files, leading to unpredictable issues.
 
Using Breadcrumbs, the "upward" path from sub2 to the project directory becomes more intuitive, such as ..project/module1/sub1/file1.txt.
How It Works:
- Initialization: A breadcrumb symlink named 
..projectis created inside theprojectdirectory, pointing to theprojectdirectory itself (.). - Progression: As we traverse towards 
sub2, at each step, another breadcrumb symlink..projectis created pointing to the parent directory's breadcrumb (../..project). - End Result: By the time we reach 
sub2, we've established a trail of breadcrumb symlinks, guiding us fromsub2back to theprojectdirectory seamlessly. 
After setting up breadcrumbs for the given example, we get the following:
project/
β
ββββ module1/
β    ββββ sub1/
β         ββββ file1.txt
β
ββββ module2
β    β
β    ββββ sub2/
β    β    ββββ ..project -> ../..project
β    β
β    ββββ ..project -> ../..project
β
ββββ ..project -> .
Then, to create a symlink inside sub2 to file1.txt, just run:
ln -s ..project/module1/sub1/file1.txtBenefits:
- Clarity: Instead of puzzling over multiple 
../, the..project/breadcrumb explicitly indicates the journey up to theprojectdirectory. - Maintainability: Breadcrumbs simplify symlink updates; adding or removing hierarchy levels often requires minimal to no breadcrumb adjustments.
 - Robustness: When a significant structural change occurs, the breadcrumb symlink explicitly fails, preventing unintended file references.
 - Documentation: The presence of breadcrumbs highlights inter-module file references, offering clear insights into file dependencies.
 
The repository also includes a ready-to-use script that showcases how this method works in practice.
Download the tarball and extract:
wget https://github.com/niqodea/breadcrumbs/releases/download/v0.2.0/breadcrumbs-v0.2.0-x86_64-unknown-linux-gnu.tar.gz
tar -xzf breadcrumbs-v0.2.0-x86_64-unknown-linux-gnu.tar.gz
then cp the breadcrumbs binary in the bin directory.
- 
Global Installation:
sudo cp breadcrumbs /usr/bin - 
Local Installation: First, ensure
~/.local/binis in yourPATH. Then:cp breadcrumbs ~/.local/bin 
Refer to the command's help message:
breadcrumbs --help
For example, to create a trail of breadcrumbs from the current directory to the one two levels above, run:
breadcrumbs trail ../..