Jump around
There are more ways to navigate the file system in bash than I imagined when I still was using cmd.exe. Let me name some:
cd
navigates to the home folder. Likecd /users/$(whoami)
orcd "$HOME"
but shorter.cd -
navigates to the previous directory. It’s like the zap-button on your television remote control!cd ~/Doc␉
tab-completion works like Visual Studio’s intelli-sense, but without the dropdown and it’s case sensitive. If there is one choice, it will complete it. If there is more, you need to press tab twice, and it will show a list.pushd
/popd
/dirs
save/load/show a directory to/from the stack. Especially handy in complex scripts.
However, I noticed I was always navigating to not that many different number of folders. I thought, wouldn’t it be handy if one could save/load folders to some kind of dictionary. I did extensive research and couldn’t find anything, so I created go. It was great. Typing go gh
performed cd ~/prj/GitHub
. To save the current folder under the name “here” would be performed by go here .
. And go
would show all the current stored definitions.
As I mentioned before, I performed thorough extensive research. I didn’t take it lightly. However. Apperently, the subject sometimes needs time to sink in. As today I learned from a guy I have known some time, that he created a tool called markjump. This is basically what I made, only for powershell. But his work was inspired by Jeroen Janssens’ shell script, from five years ago. And he’s a Dutchie too! How could I have missed that? And his code is 1500% better!
To complete my story line: Half a year ago I ran into the z-utility (can’t remember how), which has the description jump around. I was intrigued! I learnt descriptions of utilities are pretty important. And it turns out to be a pretty clever and helpful utility. It automatically remembers where you navigate to; no need to keep a list manually. And it will also keep statistics.
It uses regular expressions to find which folder you want to navigate to. And it’s case-insensitive, so z dow
will navigate to ~/Downloads
. No need to type a capital-D. When the regular expression matches multiple folders, it uses the statistics (how recent and how frequent) to decide where to navigate to.
I must say I was a bit hesitant to use it, because it seemed so… technical. In the beginning of the man-page it says something like “Tracks your most used directories, based on ‘frecency’..” But the “jump around” reeled me in. I never used my own go
-utility, and only just now looked back. Thanks rupa!