DEV Community

Discussion on: Bash: How To Teleport In The Terminal

waylonwalker profile image
Waylon Walker

I ❤️ aliases

You gotta check out rupa/z. It's not quite as reliable as an alias, it is magical. It's based on your frecently used directories.

GitHub logo rupa / z

z - jump around

Z(1)                             User Commands                            Z(1)
       z - jump around
       z [-chlrtx] [regex1 regex2 ... regexn]
       bash, zsh

       Tracks your most used directories, based on 'frecency'.

       After  a  short  learning  phase, z will take you to the most 'frecent'
       directory that matches ALL of the regexes given on the command line, in

       For example, z foo bar would match /foo/bar but not /bar/foo.

       -c     restrict matches to subdirectories of the current directory

       -e     echo the best match, don't cd

       -h     show a brief help message

       -l     list only

       -r     match by rank only

       -t     match by recent access only

       -x     remove the current directory from the datafile

       z foo         cd to most frecent dir matching foo

       z foo bar     cd to most frecent dir matching foo, then bar

       z -r foo      cd to highest ranked dir matching foo

       z -t foo      cd to most recently
ecognito profile image
E Cognito • Edited on

I use a combination of z and aliases. E.g.:

alias projects="z ~/Documents/projects"

So now, if I just type projects I'll always go to the ~/Documents/projects folder, but if I type projects img I'll have a good chance of going to the ~/Documents/projects/static/img folder.

The alias is using z, but only to change to a folder under ~/Documents/projects.

i5513 profile image

I was hopping to see this kind of tools at this post

tchoupinax profile image

Otherwise, you could use a better z :)