Using kcd

kcd Basics

kcd works by consulting the directory tree file for the list of directories available. By default the file is named ~/.kcd.save.kcd.gz but may change according to the kcd configuration file. This file is automatically created when kcd is run for the first time.

When you type the command

          kcd
it will display the saved entire directory tree and place the highlight bar on the current directory. You can use arrow keys, Page up, Page down, Home and End keys to move the highlight bar to the desired directory. Pressing Enter will exit kcd and jump the the selected directory. If you choose to remain in the current directory, just press F10 or Ctrl-C.

If you know the name of directory you want to change to, for example, /usr/include, you can type

          kcd include
To save some keystrokes, you can type only a part of include such as
          kcd incl

If kcd found from that there are more than 4 directories contain the text include or incl (for the second example), it will list all matched directories. You can again use arrow keys, Page up, Page down, etc. to move the highlight bar to /usr/include and press Enter.

If there are less than or equal 4 matched directory, kcd will pick a directory and jump. Repeat the same kcd command, in this case kcd include or kcd incl, will go to the next matched one, and so on. You can use shell's command history for this purpose. For example, in several shells, pressing Up arrow key and Enter will repeat the previous command. You may change the number of matched directory threshold to any value other than 4 by modifying configuration file. See the `Configuration File' section below.

On the other hand, if kcd cannot find the requested directory, fuzzy finding mode is used. In fuzzy mode, directories that approximately matches the given text is listed. By default, fuzzy mode will find 10 closest matches. This too can be changed by the configuration file.

You may create bookmarks via option -ba to help locate frequently accessed directories. When kcd searches for directories matching a given text and finds that at least one is bookmarked, then all non-bookmarked directories are ignored. So bookmarked directories are always chosen over non-bookmarked ones. You can override this behavior by supplying kcd with -B option before the text such as

          kcd -B incl

You can also list all bookmarked directory using -b option.

While in full screen mode, besides using arrow keys, etc. to move the highlight bar, you may type the some text string to limit the highlight bar to move between items containing the string. The text string is shown at the bottom of the screen inside [...]. To restore highlight bar behavior, press Tab key.

The list of directories used in all operations above is taken from ~/.kcd.save.gz. You may want to update it when directories are added or removed. To update the file, type

          kcd -r
This will still use some information from the old file, especially directory time stamp, to speedup directory scanning. If you found that simply using kcd -r is not accurate, most likely to be due to changed configuration file, use the following command instead
          kcd -rf