1Z(1)                             User Commands                            Z(1)
2
3
4

NAME

6       z - jump around
7

SYNOPSIS

9       z [-chlrtx] [regex1 regex2 ... regexn]
10

AVAILABILITY

12       bash, zsh
13

DESCRIPTION

15       Tracks your most used directories, based on 'frecency'.
16
17       After  a  short  learning  phase, z will take you to the most 'frecent'
18       directory that matches ALL of the regexes given on the command line, in
19       order.
20
21       For example, z foo bar would match /foo/bar but not /bar/foo.
22

OPTIONS

24       -c     restrict matches to subdirectories of the current directory
25
26       -e     echo the best match, don't cd
27
28       -h     show a brief help message
29
30       -l     list only
31
32       -r     match by rank only
33
34       -t     match by recent access only
35
36       -x     remove the current directory from the datafile
37

EXAMPLES

39       z foo         cd to most frecent dir matching foo
40
41       z foo bar     cd to most frecent dir matching foo, then bar
42
43       z -r foo      cd to highest ranked dir matching foo
44
45       z -t foo      cd to most recently accessed dir matching foo
46
47       z -l foo      list all dirs matching foo (by frecency)
48

NOTES

50   Installation:
51       Put something like this in your $HOME/.bashrc or $HOME/.zshrc:
52
53              . /path/to/z.sh
54
55       cd around for a while to build up the db.
56
57       PROFIT!!
58
59       Optionally:
60              Set $_Z_CMD to change the command name (default z).
61              Set $_Z_DATA to change the datafile (default $HOME/.z).
62              Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
63              Set  $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your‐
64              self.
65              Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude.
66              Set $_Z_OWNER to allow usage when in 'sudo -s' mode.
67              (These settings should go  in  .bashrc/.zshrc  before  the  line
68              added above.)
69              Install  the  provided  man  page z.1 somewhere in your MANPATH,
70              like /usr/local/man/man1.
71
72   Aging:
73       The rank of directories maintained by z undergoes aging based on a sim‐
74       ple  formula.  The  rank  of each entry is incremented every time it is
75       accessed. When the sum of ranks is over 9000, all ranks are  multiplied
76       by 0.99. Entries with a rank lower than 1 are forgotten.
77
78   Frecency:
79       Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted
80       rank that depends on how often and how recently something occurred.  As
81       far as I know, Mozilla came up with the term.
82
83       To  z,  a directory that has low ranking but has been accessed recently
84       will quickly have higher rank than a directory  accessed  frequently  a
85       long time ago.
86
87       Frecency is determined at runtime.
88
89   Common:
90       When multiple directories match all queries, and they all have a common
91       prefix, z will cd to the shortest matching directory, without regard to
92       priority.   This  has  been  in effect, if undocumented, for quite some
93       time, but should probably be configurable or reconsidered.
94
95   Tab Completion:
96       z supports tab completion. After any number of arguments, press TAB  to
97       complete on directories that match each argument. Due to limitations of
98       the completion implementations, only the last  argument  will  be  com‐
99       pleted in the shell.
100
101       Internally,  z  decides you've requested a completion if the last argu‐
102       ment passed is an absolute path to  an  existing  directory.  This  may
103       cause unexpected behavior if the last argument to z begins with /.
104

ENVIRONMENT

106       A function _z() is defined.
107
108       The contents of the variable $_Z_CMD is aliased to _z 2>&1. If not set,
109       $_Z_CMD defaults to z.
110
111       The environment variable $_Z_DATA can be used to control  the  datafile
112       location. If it is not defined, the location defaults to $HOME/.z.
113
114       The  environment variable $_Z_NO_RESOLVE_SYMLINKS can be set to prevent
115       resolving of symlinks. If  it  is  not  set,  symbolic  links  will  be
116       resolved when added to the datafile.
117
118       In bash, z appends a command to the PROMPT_COMMAND environment variable
119       to maintain its database. In zsh, z appends a function _z_precmd to the
120       precmd_functions array.
121
122       The  environment  variable $_Z_NO_PROMPT_COMMAND can be set if you want
123       to handle PROMPT_COMMAND or precmd yourself.
124
125       The environment variable $_Z_EXCLUDE_DIRS can be set  to  an  array  of
126       directory  trees  to  exclude  from tracking. $HOME is always excluded.
127       Directories must be full paths without trailing slashes.
128
129       The environment variable $_Z_OWNER can be  set  to  your  username,  to
130       allow usage of z when your sudo environment keeps $HOME set.
131

FILES

133       Data  is  stored  in  $HOME/.z.  This  can be overridden by setting the
134       $_Z_DATA environment variable. When initialized, z will raise an  error
135       if this path is a directory, and not function correctly.
136
137       A man page (z.1) is provided.
138

SEE ALSO

140       regex(7), pushd, popd, autojump, cdargs
141
142       Please file bugs at https://github.com/rupa/z/
143
144
145
146z                                January 2013                             Z(1)
Impressum