You are not logged in.
Hi all,
One of the most used shell commands is "cd". A quick survey among my friends revealed that between 10 and 20% of all commands they type are actually cd commands! Unfortunately, jumping from one part of your system to another with cd requires to enter almost the full path, which isn't very practical and requires a lot of keystrokes.
To address this problem, I've created a little tool called autojump. Autojump is a faster way to navigate your filesystem. It works by maintaining a database of the directories you use the most from the command line. The jstat command shows you the current contents of the database. You need to work a little bit before the database becomes useable. Once your database is reasonably complete, you can "jump" to a directory by typing:
j dirspec
where dirspec is a few characters of the directory you want to jump to. It will jump to the most used directory whose name matches the pattern given in dirspec.
EXAMPLES
j mp3
could jump to /home/gwb/my mp3 collection, if that is the directory in which you keep your mp3s.
jstat
will print out something in the lines of:
...
54.5: /home/shared/musique
60.0: /home/joel/workspace/coolstuff/glandu
83.0: /home/joel/workspace/abs_user/autojump
96.9: /home/joel/workspace/autojump
141.8: /home/joel/workspace/vv
161.7: /home/joel
Total key weight: 1077
The "key weight" reflects the amount of time you spend in a directory.
To install,
yaourt -S autojump
You need to source /etc/profile in your .bashrc for this to work. Your terminal might also need restarting after the installation.
Last edited by lardon (2009-02-12 08:36:03)
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Ha! That seems quite useful. You've now made me want something similar with all user-specified jumps
j t
jump to my torrents
j d
jump to my downloads
j w
jump to my web files
But kudos to your more advanced one. Keep up the good work.
Offline
Thanks for the feedback!
Note: you actually can do what you want with the current autojump, because "downloads" and "web" don't contain a t (only "torrents" does), and so on. If if that weren't the case, usually two or three letters are enough. I've been using it for a few months now, and now I couldn't live without it
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Ha! That seems quite useful. You've now made me want something similar with all user-specified jumps
I'd just use alias or environment variables for this.
This is a very interesting project. How does autojump determine which directories are most common? Do you have to use the tool when changing directories so it can determine which directories are most used? Or does it parse the bash history for cd/pushd commands?
Dusty
Offline
This is a very interesting project. How does autojump determine which directories are most common? Do you have to use the tool when changing directories so it can determine which directories are most used? Or does it parse the bash history for cd/pushd commands?
Dusty
It does it by pure magic . Seriously, it uses the bash PROMPT_COMMAND environment variable, which is a command that executes each time the prompt is displayed, to increment the counter of the current directory. That way it's fully automated, doesn't intrude in your workflow, and continously adapts to the way you work. It's much more flexible than static, user-specified jumps.
The database is stored in ~/.autojump_py, and is a python pickle file.
Last edited by lardon (2009-02-11 17:13:53)
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
It does it by pure magic
. Seriously, it uses the bash PROMPT_COMMAND environment variable, which is a command that executes each time the prompt is displayed, to increment the counter of the current directory. That way it's fully automated, doesn't intrude in your workflow, and continously adapts to the way you work. It's much more flexible than static, user-specified jumps.
Smart! I'll have to try it. Just as soon as I get back to my Arch.
The database is stored in ~/.autojump_py, and is a python pickle file.
I'd suggest sqlite, pickles have a tendency to bite you when you want to extend something.
If cactus jumps in here with a picture of pickles biting people, my day will be complete. Send in the tacos.
Dusty
Offline
The database is stored in ~/.autojump_py, and is a python pickle file.
I'd suggest sqlite, pickles have a tendency to bite you when you want to extend something.
Dusty
The pickle only stores a dictionnary . Anyways, even though this works great already, it's mainly a proof of concept. If the idea catches on, I think the best would be to integrate it directly into bash.
Last edited by lardon (2009-02-11 17:33:20)
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
cool project, I just tried it out and it works pretty nicely.
Offline
yeah, something to play with
sounds pretty nice.
Offline
Note: if you want to make changes to autojump, please fork the github project: http://wiki.github.com/joelthelion/autojump
That way I can merge in your changes if they are interesting, and everybody can benefit.
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Sounds like a nice tool, will give it a try. I'm using apparix at the moment since it is a little more comfortable than simple alias definitions.
Offline
As a side note: instead of cd'ing, try
pushd
and
popd
.
Offline
Hi! I found a bug, what should I do?
Offline