|
NAMEkcd - Directory Change UtilitySYNOPSISkcd [-B] [DIR_SHORTCUT] [MATCH_NUMBER]kcd [-b DIR_SHORTCUT] [-ba [DIR [...]]] [-br [DIR [...]]] [--config] [--configattr] [--features] [-h] [--help] [-M] [-p PROFILE] [-r] [-rf] [-rp DIR] [-rq] [-rQ] [-t [DIR]] [-tr [DIR]] [-T] [-v] [--version] eval `kcdmain [-ia] [-ic] [-if] [-ias KCD_DIR] [-ics KCD_DIR] [-ifs KCD_DIR] ` DESCRIPTIONkcd is a set of programs that help you navigate through directories easily. 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 without any parameter, 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. 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. If you know the name of directory you want to change to, you can type only a part of directory name as DIR_SHORTCUT parameter. If kcd found from that there are more than 4 directories contain the text, it will list all matched directories. You can again use arrow keys, Page Up, Page Down, etc. to move the highlight bar 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 will go to the next matched one, and so on. 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. Optionally, you may specify MATCH_NUMBER so that the directory corresponding to the number in the matched list is used and kcd jump to that directory immediately. The DIR_SHORTCUT may contain special symbols / and // to force the matching of parent directories as well. For example kcd usr/bin matches /usr/bin and /usr/sbin but not /usr/local/bin since the directory containing usr and bin must appeared right next to each other. On the other hand kcd usr//bin allows any number of directories between the usr and bin and also matches /usr/local/bin and /usr/local/lib/mozilla/bin. OPTIONS
Rescan options can be combined, i.e., `kcd -rf -rq' is the same as `kcd -rfq'. Following parameters are useful when you type `kcd' and get a command not found error. `kcd' is actually a shell function or shell alias so it must be setup before you can type any kcd command. You will have to use `kcdmain' as the command name (since kcd command is not available yet).
DIRECTORY TREE WINDOWThe directory tree window appears when you type kcd without any other parameter. Initially kcd is in the navigation mode. You can use arrow keys to move the highlight bar to any directory you want. There is another mode called find mode which can be distinguish from navigation mode by the string ` Find: ' displayed at the bottom of the screen. Pressing arrow keys will move the highlight bar to the nearest directory containing the search string inside the brackets ([...]). Displayed at the last row on screen is the full path name of highlighted directory.KEYS IN NAVIGATION MODE
KEYS IN FIND MODE
For terminals without function keys, you can press ^F+num where num is from 0 to 9 to get the same result. ^F+1 (Press and hold `Ctrl' key, press and release `F', release `Ctrl', then press `1') is the same as F1. Similarly ^F+2 to ^F+9 correspond to F2 to F9 respectively. To emulate F10, use ^F+0. DIRECTORY LEGENDSAll accessible directories (except links) are shown as green (color console) or underlined (B&W console) and can be selected./dev and /proc plus other directories specified in SkipDir setting are shown with [skipped]. Subdirectories inside skipped directories are not displayed but you may able to access them using shell's cd command. Directories with [*] means that it is not present in the saved file. They are added automatically to the screen when current directory is not in the file. The changes are not written to the file. So you have to rescan directory if you do not intend to skip them. Directories without execute permission are shown with [unreadable]. You cannot change to this directory. Directories without read permission but with execute permission are also shown with [unreadable] you cannot read the content of the directory (using the ls command). Symbolic links are shown with -> and the destination directory. Selecting a symbolic link will jump to its destination directory while still staying in kcd. You can navigate further or just press Enter to jump there. Some symbolic links may point to a directory outside the saved directory tree given in the StartDir configuration command. These are displayed with [outside tree] Enter will jump there immediately. ALTERNATE KEY BINDINGYou may change the keys used in kcd via KeyBinding configuration commands. Besides the default or kcd mode, Vi and Emacs modes are available. The following is the summary of keys available in these two modes. All arrow key, PageUp, PageDown, function keys retains the same meaning as the default key binding.Vi Mode
For most commands, a number prefix to indicate the repeat count, such as 5^B representing previous 5 pages, is supported. Emacs mode
CONFIGURATION FILEkcd consults settings in /etc/kcd.conf, /usr/etc/kcd.conf, /usr/local/etc/kcd.conf and ~/.kcd.conf, (in that order), each time the program executes if available. Commands in the latter configuration file will usually override the former one. However, you have to use the ClearStartDir and ClearSkipDir commands in ~/.kcd.conf, for example, if you want to undo StartDir and SkipDir commands in /etc/kcd.conf.The syntax of each command is command_name = value All command names are case-insensitive. Values, however, depends on whether the command requests a double quoted value or not. Only values NOT in double quotes are treated as case-insensitive. There are 2 possible ways to specify value for double quoted string: glob, and regular expression. Glob uses characters like `?' and `*' as wildcards. It is placed within a pair of double quotes like "/usr/lib/lib*". Regular expression uses extended regular expression format and is placed within double quotes prefixed by either `R' or `r' such as r"/usr/lib/lib[a-z]-.*". kcd automatically adds a `^' and `$' at the beginning and the end of string, respectively. The symbol `#' serves as comment and all characters starting from `#' till end of line are ignored. The `#' inside double quotes, however, will be treated as part of value passed to the command. COMMAND SUMMARY
SCREEN ATTRIBUTE COMMAND SUMMARYScreen attribute command for color display has the following syntax:<ITEM>ColorAttr = [normal | <ATTR> ...] <FG_COLOR> on <BG_COLOR> while for black and white display is: <ITEM>BWAttr = [normal | <ATTR>] Available values for <ITEM>:
Available values for <ATTR>:
Available values for <FG_COLOR> and <BG_COLOR>:
<BG_COLOR> can also be Default which means that the background color of the directory tree window is used here. Example: # Change both foreground and background
Note: Whether a particular combination of attributes and/or colors works is terminal dependent. QUOTING RULESThe following symbols have special meanings inside double quotes values (such as in SkipDir command):\ ' " ` ~ and * ? [ ] for glob, or ^ . [ ] $ ( ) | * + ? { } for regular expression. Currently the commands SkipDir, ClearSkipDir, ClearStartDir, ClearMountDir can accept glob or regular expression. `~' and `~username', where username is an account name, are properly expanded to home directory when it appears at the beginning of the string. The special symbols ``' and `'' are reserved for future use. Control characters can be entered using \xHH quoting where HH is the hexadecimal value of the character. GLOB SPECIAL CHARACTERSShell wildcards normally does not match `/' and the leading `.' but the behavior can be overridden using GlobPath and GlobDot commands respectively. Here is the list of wildcard pattern that kcd recognizes:
Example:
Note that the matching rules depends on the C library in your system. The above rules apply when you have POSIX.2 conforming library. System with older libraries may not accept some of the rules. If you want these symbols inside double quotes to actually refer to the characters. You have to add an extra `\' in front of them. Note that here, `*'band `?' refer to characters inside directory name, not wildcards. For example: SkipDir = "~/\`Cool\?\'" is used to skip the directory named `Cool?' (the enclosing quotes and the question mark are parts of the directory name) inside your home directory. (You may not know that can created this kind of weird directory name!) REGULAR EXPRESSION SPECIAL CHARACTERSFor information check Section 7 of `regex' man pages, i.e., type `man 7 regex' in command line.SAMPLE CONFIGURATION FILEFollowing is for directory tree starting from root directory:# Sample configuration file for kcd
Following is for directory tree starting from home directory: # Another sample configuration file for kcd
PROFILESThis feature allows kcd to behave differently depending on the invoked profile name. The following is an example of configuration file containing multiple profiles.[kcd]
With the example above, two shell functions/aliases are introduced, `kcd' and `hcd'. If you type `kcd' in the command line, the entire system is searched and displayed. But if you want to restrict to only inside home directory, you can use `hcd' command instead. More profiles can be introduced using in similar manner. There is no limit on the number of profiles. The only restriction is the name of the profile. The profile name must be a valid C or C++ identifier, i.e., contains only alphanumeric characters or underscore and must not begin with a number. There are two special profiles, `*' and `kcd'. The `*' profile is the default profile and is used for commands when no profile name is specified. The `kcd' profile is always created regardless if it actually appears in the configuration file. An ordinary profile (including `kcd'), when declared, will be initialized from the current configuration of `*'. Afterward, any changes to `*' does not affect the previously initialized one. Here is an example. ShowListThreshold = 3 # No profile specified yet,
Note: Profile may not work on some shells such as ash. bash and tcsh work fine. COMMON ERROR MESSAGESShell message reporting that it cannot find a particular file or directory (the actual message depends on the shell used).For example, bash displays `bash: dirname: No such file or directory'
`kcd: cannot find a link containing the string ...'
1. There may be some typos in directory name given.
Solution: Retype the correct name. 2. The desired directory is created after the last directory scan. Solution: Rescan directory. 3. kcd has been configured to skip it. Solution: Change directory manually by the `cd' command or modify the configuration file (See the previous section). `kcd: your ncurses library is bad. Refer to kcd README file for solution'
1. ncurses library (libncurses.a or libncurses.so.X.X.X) in /usr/lib) and header file (/usr/include/curses.h) do not match. 2. The library is built based using a different configuration, compiler or library that is incompatible with the current installed ones. 3. The library is built not to support C++ applications.
AUTHORkcd is copyrighted (c) 1996,1997-9,2000-4,2005 by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>. For bug report, visit the program home page is athttp://kcd.sourceforge.net
Visit the GSP FreeBSD Man Page Interface. |