A cd command that learns - easily navigate directories from the command line

Overview

NAME

autojump - a faster way to navigate your filesystem

DESCRIPTION

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.

Directories must be visited first before they can be jumped to.

USAGE

j is a convenience wrapper function around autojump. Any option that can be used with autojump can be used with j and vice versa.

  • Jump To A Directory That Contains foo:

    j foo
    
  • Jump To A Child Directory:

    Sometimes it's convenient to jump to a child directory (sub-directory of current directory) rather than typing out the full name.

    jc bar
    
  • Open File Manager To Directories (instead of jumping):

    Instead of jumping to a directory, you can open a file explorer window (Mac Finder, Windows Explorer, GNOME Nautilus, etc.) to the directory instead.

    jo music
    

    Opening a file manager to a child directory is also supported:

    jco images
    
  • Using Multiple Arguments:

    Let's assume the following database:

    30   /home/user/mail/inbox
    10   /home/user/work/inbox
    

    j in would jump into /home/user/mail/inbox as the higher weighted entry. However you can pass multiple arguments to autojump to prefer a different entry. In the above example, j w in would then change directory to /home/user/work/inbox.

For more options refer to help:

autojump --help

INSTALLATION

REQUIREMENTS

  • Python v2.6+ or Python v3.3+
  • Supported shells
    • bash - first class support
    • zsh - first class support
    • fish - community supported
    • tcsh - community supported
    • clink - community supported
  • Supported platforms
    • Linux - first class support
    • OS X - first class support
    • Windows - community supported
    • BSD - community supported
  • Supported installation methods
    • source code - first class support
    • Debian and derivatives - first class support
    • ArchLinux / Gentoo / openSUSE / RedHat and derivatives - community supported
    • Homebrew / MacPorts - community supported

Due to limited time and resources, only "first class support" items will be maintained by the primary committers. All "community supported" items will be updated based on pull requests submitted by the general public.

Please continue opening issues and providing feedback for community supported items since consolidating information helps other users troubleshoot and submit enhancements and fixes.

MANUAL

Grab a copy of autojump:

git clone git://github.com/wting/autojump.git

Run the installation script and follow on screen instructions.

cd autojump
./install.py or ./uninstall.py

AUTOMATIC

Linux

autojump is included in the following distro repositories, please use relevant package management utilities to install (e.g. apt-get, yum, pacman, etc):

  • Debian, Ubuntu, Linux Mint

    All Debian-derived distros require manual activation for policy reasons, please see /usr/share/doc/autojump/README.Debian.

  • RedHat, Fedora, CentOS

    Install autojump-zsh for zsh, autojump-fish for fish, etc.

  • ArchLinux

  • Gentoo

  • Frugalware

  • Slackware

OS X

Homebrew is the recommended installation method for Mac OS X:

brew install autojump

MacPorts is also available:

port install autojump

Windows

Windows support is enabled by clink which should be installed prior to installing autojump.

KNOWN ISSUES

  • autojump does not support directories that begin with -.

  • For bash users, autojump keeps track of directories by modifying $PROMPT_COMMAND. Do not overwrite $PROMPT_COMMAND:

    export PROMPT_COMMAND="history -a"
    

    Instead append to the end of the existing $PROMPT_COMMAND:

    export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a"
    

REPORTING BUGS

For any questions or issues please visit:

https://github.com/wting/autojump/issues

AUTHORS

autojump was originally written by Joël Schaerer, and currently maintained by William Ting. More contributors can be found in AUTHORS.

COPYRIGHT

Copyright © 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Comments
  • autojump doesn't work with Mac OS X Lion

    autojump doesn't work with Mac OS X Lion

    since I installed Lion on my mac I get this error if i start my terminal: -bash: PROMPT_COMMAND: line 4: syntax error near unexpected token ;' -bash: PROMPT_COMMAND: line 4:update_terminal_cwd; ; { [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'

    opened by nicolashohm 40
  • hash md5 error on Mac

    hash md5 error on Mac

    I install autojump and it works quite well until today. Every time I open a directory a mass of python error msg is printed to the terminal. I install buck and watchman with homebrew today.

    If I uninstall autojump, the error msg dismiss. Is there any way to fix it?


    The detail of error msg is as following:

    ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code for hash sha1 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha1 ERROR:root:code for hash sha224 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha224 ERROR:root:code for hash sha256 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha256 ERROR:root:code for hash sha384 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha384 ERROR:root:code for hash sha512 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha512 /Users/huxuyang/dev/BeautyCamera ➜ BeautyCamera git:(feature-v1.7.7) ✗ ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code for hash sha1 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha1 ERROR:root:code for hash sha224 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha224 ERROR:root:code for hash sha256 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha256 ERROR:root:code for hash sha384 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha384 ERROR:root:code for hash sha512 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha512

    invalid packaging-homebrew 
    opened by thundertrick 34
  • Mac OS X

    Mac OS X

    Install script does not seem to go through all necessary steps in order to install autojump on OS X.

    Problem is that .bashrc is not called when user starts Terminal.app. There is a really easy fix for it thou.

    Add following lines into .bash_profile:

        # Get the aliases and functions
        if [ -f ~/.bashrc ]; then
          . ~/.bashrc
        fi
    
    opened by ciudilo 33
  • ZSH tab autocompletion

    ZSH tab autocompletion

    Hello,

    I'm pretty new to the zsh, and installed https://github.com/robbyrussell/oh-my-zsh

    j + [tab_key] works perfectly in bash, but something wrong in zsh, please help.

    bug 
    opened by a-b 28
  • Cannot get fresh install to work on Windows 7

    Cannot get fresh install to work on Windows 7

    I installed clink, then cloned the repository and called install.py. I added C:/Users/xxxxx/AppData\Local\autojump\bin to my path environment variable in my Powershell profile and launched a new instance of Powershell. The command was recognized but I am unable to jump to any directory. No matter what I do, I get an error message:

    > j C:\github
    autojump: directory C:\github not found
    try `autojump --help` for more information
    

    I also tried this in cmd, with the same results. Have I missed something here in my install?

    needs-info os-windows 
    opened by Kazark 22
  • autojump follows symlinks

    autojump follows symlinks

    I have a ~/work folder which is a symlink to /Volumes/encrypted/work but I would like to not see this full path every time I want to jump to a project folder.

    Is there a way to switch off this feature?

    opened by erikkaplun 20
  • autojump losing settings/database?? /cry

    autojump losing settings/database?? /cry

    This may seem like an odd issue + it's hard to describe. I loved this tool, but recently it feels like it is losing my settings constantly. I have these settings in my bash setup that a friend told me were required so I wanted to mention them to inquire if they have something to do with it. Is there anything else I can provide to help with this?

    Thank you so much for your help. Let me know if I can gittip ya or something.

    Cheers.

    # ZSH Autocomplete
    autoload -U compinit && compinit
    
    needs-info 
    opened by chrishough 19
  • Set prefix in install.sh?

    Set prefix in install.sh?

    Hey,

    I think it would be cool to write up an autojump installation script with homebrew, which a ton of people use to manage their macs, but this would require the ability to set the PREFIX= of autojump, so that it could be installed in a different location and symlinked to /usr/local/bin.

    Would this be tricky to pull off? I could help out if necessary.

    Thanks for the awesome work - I've been dying for something like this for a while.

    opened by tmcw 19
  • Approximate matching (to handle typos)

    Approximate matching (to handle typos)

    This is a fairly large pull request, so I'll try my best to explain how it came about.

    I have a tendency to make typos at the command line, and I wished autojump could make a best guess despite these typos. This is how I implemented it: if autojump turns up no matches when it does a simple substring search, it tries again by ranking the list of directories by edit distance. A directory is only considered as a candidate if it is at an edit distance of 2 or less.

    As edit distance algorithms are fairly slow creatures, I wrote a short script to profile autojump's performance. In the course of doing so I found a fairly big bottleneck in the code -- os.path.realpath was being called unnecessarily often. After I factored it out, autojump did its completions in about 80% less time.

    After I added in the edit distance ranking, these timings jumped back up by about the same amount. So autojump should not be much slower than it was originally if the user makes a typo. On the other hand, if autojump manages to find a match via simple substring matching, it should retain that 80% speedup.

    The profiling code has to be run from the project root as 'python profile/profile.py [outfile]`. It measures the time taken to create completions for patterns of length 1-10. It's somewhat kludgey code, so if you'd rather not include it, I'd be happy to edit it out of this pull request.

    enhancement 
    opened by int3 18
  • How should distribution package the latest autojump?

    How should distribution package the latest autojump?

    Distributions (Arch Linux example: https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/autojump) use this kind of command to package autojump:

    $ ./install.py --destdir "${pkgdir}" --prefix 'usr/' --zshshare 'usr/share/zsh/site-functions'
    

    But this creates broken '/etc/profile.d/autojump.sh' config files with a custom path dependent on the compile time folder location and not the actual prefix location (example from a custom build on my system):

    # the login $SHELL isn't always the one used
    # NOTE: problems might occur if /bin/sh is symlinked to /bin/bash
    if [ -n "${BASH}" ]; then
        shell="bash"
    elif [ -n "${ZSH_NAME}" ]; then
        shell="zsh"
    elif [ -n "${__fish_datadir}" ]; then
        shell="fish"
    elif [ -n "${version}" ]; then
        shell="tcsh"
    else
        shell=$(echo ${SHELL} | awk -F/ '{ print $NF }')
    fi
    
    # prevent circular loop for sh shells
    if [ "${shell}" = "sh" ]; then
        return 0
    
    # check local install
    elif [ -s ~/.autojump/share/autojump/autojump.${shell} ]; then
        source ~/.autojump/share/autojump/autojump.${shell}
    
    # check global install
    elif [ -s /usr/local/share/autojump/autojump.${shell} ]; then
        source /usr/local/share/autojump/autojump.${shell}
    
    fi
    
    # check custom install         
    if [ -s /home/tim/projects/perso/asp/autojump/repos/community-any/pkg/autojump/etc/profile.d/autojump.${shell} ]; then             
        source /home/tim/projects/perso/asp/autojump/repos/community-any/pkg/autojump/etc/profile.d/autojump.${shell}         
    fi
    

    The expected custom section:

    # check custom install         
    if [ -s /usr/share/autojump/autojump.${shell} ]; then             
        source /usr/share/autojump/autojump.${shell}         
    fi
    

    Fixing this is more than just replacing 'etc_dir' by 'share_dir' in install.py:210 (which might be a good thing to do too), so I'm asking for inputs.

    bug 
    opened by Siosm 17
  • Support for mingw and cygwin

    Support for mingw and cygwin

    I want to use this tools in mingw,but there is some problems

    1. mingw use bash 3.1 ,which don't support process substitution and "=~" operator
    2. python on windows don't have os.getuid() function
    3. windows don't have sudo command I think it will also work on cygwin, but have not tested.
    opened by xiaonaitong 17
  • possible bug when search string starts with all

    possible bug when search string starts with all

    I have been using autojump for a long time without any problems, but I ran into my first possible bug today. When I do j all press tab and then enter, I get the following error:

    ➜ j all__
    Traceback (most recent call last):
      File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 342, in <module>
        sys.exit(main(parse_arguments()))
      File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 326, in main
        get_ith_path(
      File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 324, in <lambda>
        get_ith_path = lambda i, iterable: last(take(i, iterable)).path
    AttributeError: 'NoneType' object has no attribute 'path'
    autojump: directory 'all__' not found
    

    Doing something like j mech followed by tab and enter works just fine. It seems that the character combination mentioned somehow trips up autojump.

    I am on macOS Ventura, using iTerm with zsh 5.8.1 (x86_64-apple-darwin22.0)

    opened by schalkneethling 0
  • How did you create executable that is readable in Python?

    How did you create executable that is readable in Python?

    /bin/autojump file is executable, but also readable file. It's in Python. I've used pyinstaller and the executable file is not readable. I am wondering how did you create executable that is readable in Python. I would really appreciate your answer. Thanks.

    opened by chimd715 0
  • How to fix when I input '-' , but terminal show '_j:compadd:5: bad option: -_'

    How to fix when I input '-' , but terminal show '_j:compadd:5: bad option: -_'

    hi,

    I install autojump by clone repo then run python install.py

    when i run shell

    # i want todo
    j -h
    
    # but terminal show
    _j:compadd:5: bad option: -_
    _j:compadd:5: bad option: -_
    _j:compadd:5: bad option: -_
    _j:compadd:5: bad option: -_
    _j:compadd:5: bad option: -_
    

    I use macos add zsh.

    opened by ningyougan 0
  • Update README.md

    Update README.md

    Added:

    • The given git clone command: git clone git://github.com/wting/autojump.git doesnt work.

    • Updated with the working git clone command git clone https://github.com/autojump

    • Added Extra steps to add source files to users respective shells

    opened by kiranraaj19 2
Owner
William Ting
William Ting
Easily turn single threaded command line applications into a fast, multi-threaded application with CIDR and glob support.

Easily turn single threaded command line applications into a fast, multi-threaded application with CIDR and glob support.

Michael Skelton 1k Jan 7, 2023
CLI Utility to encode and recursively recreate directories with ffmpeg.

FFenmass CLI Utility to encode and recursively recreate directories with ffmpeg. Report Bug · Request Feature Table of Contents Getting Started Prereq

George Av. 8 May 6, 2022
AML Command Transfer. A lightweight tool to transfer any command line to Azure Machine Learning Services

AML Command Transfer (ACT) ACT is a lightweight tool to transfer any command from the local machine to AML or ITP, both of which are Azure Machine Lea

Microsoft 11 Aug 10, 2022
Ros command - Unifying the ROS command line tools

Unifying the ROS command line tools One impairment to ROS 2 adoption is that all

null 37 Dec 15, 2022
Library and command-line utility for rendering projects templates.

A library for rendering project templates. Works with local paths and git URLs. Your project can include any file and Copier can dynamically replace v

null 808 Jan 4, 2023
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Dec 30, 2022
instant coding answers via the command line

howdoi instant coding answers via the command line Sherlock, your neighborhood command-line sloth sleuth. Are you a hack programmer? Do you find yours

Benjamin Gleitzman 9.8k Jan 8, 2023
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie

HTTPie: human-friendly CLI HTTP client for the API era HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI in

HTTPie 25.4k Dec 30, 2022
A supercharged AWS command line interface (CLI).

SAWS Motivation AWS CLI Although the AWS CLI is a great resource to manage your AWS-powered services, it's tough to remember usage of: 70+ top-level c

Donne Martin 5.1k Jan 5, 2023
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
Command-line tool for looking up colors and palettes.

Colorpedia Colorpedia is a command-line tool for looking up colors, shades and palettes. Supported color models: HEX, RGB, HSL, HSV, CMYK. Requirement

Joohwan Oh 282 Dec 27, 2022
A command line utility for tracking a stock market portfolio. Primarily featuring high resolution braille graphs.

A command line stock market / portfolio tracker originally insipred by Ericm's Stonks program, featuring unicode for incredibly high detailed graphs even in a terminal.

Conrad Selig 51 Nov 29, 2022
Get latest astronomy job and rumor news in your command line

astrojobs Tired of checking the AAS job register and astro rumor mill for job news? Get the latest updates in the command line! astrojobs automaticall

Philip Mocz 19 Jul 20, 2022
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Phil Wang 4.4k Jan 9, 2023
Command line interface for testing internet bandwidth using speedtest.net

speedtest-cli Command line interface for testing internet bandwidth using speedtest.net Versions speedtest-cli works with Python 2.4-3.7 Installation

Matt Martz 12.4k Jan 8, 2023
Free and Open-Source Command Line tool for Text Replacement

Sniplet Free and Open Source Text Replacement Tool Description: Sniplet is a work in progress CLI tool which can do text replacement globally in Linux

Veeraraghavan Narasimhan 13 Nov 28, 2022
Universal Command Line Interface for Amazon Web Services

This package provides a unified command line interface to Amazon Web Services.

Amazon Web Services 13.3k Jan 7, 2023
organize your books on the command line

organize your books on the command line

Ben Winston 19 Jan 21, 2022