DEV Community

Discussion on: Bash: How To Teleport In The Terminal

Collapse
 
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)
NAME
       z - jump around
SYNOPSIS
       z [-chlrtx] [regex1 regex2 ... regexn]
AVAILABILITY
       bash, zsh

DESCRIPTION
       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
       order.

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

OPTIONS
       -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

EXAMPLES
       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
Collapse
 
ecognito profile image
E Cognito • Edited

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.

Collapse
 
i5513 profile image
i5513

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

Collapse
 
tchoupinax profile image
Tchoupinax

Otherwise, you could use a better z :)
github.com/ajeetdsouza/zoxide