3 ms·
One of my favorite bash tricks is that I have this alias in my bashrc file: function goto { cd -P ~/.links/"$1"; } And then in the `.links` folder
by war1025 6y ago
One of my favorite bash tricks is that I have this alias in my bashrc file:
function goto {
cd -P ~/.links/"$1";
}
And then in the `.links` folder I have symbolic links to directories I need to go to often.
Then getting to a frequently used directory is just a `goto X` away.
- erik_seaberg 6y agoCool. How does that compare with setting CDPATH?
- war1025 6y agoI just looked up CDPATH and my understanding is that the difference between the two is that with CDPATH you are setting directories that you can quickly navigate to subdirectories of. This is more of a quick link to directories themselves. Maybe you could do something similar to the alias if you had my `~/.links` directory in your CDPATH, but then you'd still need to add the `-P`every time to get it to follow the symbolic link. Not something I had ever thought of before honestly.
- bruh2 6y agoOoh, that's cool. You might be interested at z[1]. It kinda fills the same purpose as your trick, except it automatically figures out what are your most used directories by tracking your shell navigation or something. [1] https://github.com/rupa/z/wiki https://github.com/rupa/z/wiki