1wcd(1) 2018-05-10 wcd(1)
2
3
4
6 wcd - Wherever Change Directory
7
8 chdir for DOS and Unix
9
11 wcd [options] [directory]
12
14 Overview
15 Wcd is a command-line program to change directory fast. It saves time
16 typing at the keyboard. One needs to type only a part of a directory
17 name and wcd will jump to it. Wcd has a fast selection method in case
18 of multiple matches and allows aliasing and banning of directories. Wcd
19 also includes a full screen interactive directory tree browser with
20 speed search.
21
22 Wcd was modeled after Norton Change Directory (NCD). NCD appeared first
23 in The Norton Utilities, Release 4, for DOS in 1987, published by Peter
24 Norton.
25
26 Wcd has been ported to different command-line shells: DOS command.com,
27 Windows cmd.exe and PowerShell, OS/2 cmd.exe, and Unix shells such as
28 Bourne (sh), Bourne Again (bash), Korn (ksh), Z (zsh), and C (csh)
29 shell and others running on any operating system.
30
31 Wcd supports 8 bit character sets on all systems, and has optional
32 support for Unicode. See section LOCALIZATION.
33
34 See section INSTALLATION how to setup wcd for personal use.
35
36 Basic use
37 By default (if no wildcards are used) wcd searches for a directory with
38 a name that begins with the typed name.
39
40 For instance this command will change to directory to the current
41 user's "/home/user/Desktop":
42
43 wcd Desk
44
45 When there are multiple matches, wcd will present the user a list of
46 all matches. The user can then make a selection with a few keystrokes
47 (most of the times only one).
48
49 Wildcards
50 Wcd supports following wildcards:
51
52 * matches any sequence of characters (zero or more)
53 ? matches any character
54 [SET] matches any character in the specified set,
55 [!SET] or [^SET] matches any character not in the specified set.
56
57 A set is composed of characters or ranges; a range looks like character
58 hyphen character as in "0-9" or "A-Z". The "[0-9a-zA-Z_]" is the
59 minimal set of characters allowed in the "[..]" pattern construct.
60 International characters (i.e. 8 bit characters) are allowed if the
61 system supports them. To suppress the special syntactic significance of
62 any of "[]*?!^-\" inside or outside a "[..]" construct and match the
63 character exactly, precede the character with a backslash ("\") marker.
64
65 Using wildcards makes powerful searching possible. For instance this
66 matches any directory name that ends with "top":
67
68 wcd *top
69
70 Match directories that have "top" anywhere in the name:
71
72 wcd *top*
73
74 Match any directory name that begins with "a", "b" or "c":
75
76 wcd [a-c]*
77
78 It is also possible to give a part of a directory path. Here Wcd
79 searches for directory that begins with "Desk" and which path matches
80 *me/Desk*.
81
82 wcd me/Desk
83
84 It is allowed to type any kind of expression with slashes and
85 wildcards. E.g.:
86
87 wcd src*/*1?/a*2
88
89 Other uses
90 If no wildcards are used and wcd finds a perfect match, wcd will ignore
91 all wild matches by default. This behaviour can be changed with the -w
92 option.
93
94 The interactive directory tree browser can be started by using option
95 -g.
96
97 wcd -g
98
99 Wcd generates a treedata file where it searches the directory. On Unix
100 and Windows systems wcd does add symbolic links to the treedata file
101 while scanning the disk, but does not follow them. While following
102 links wcd could end up scanning infinite loops, or scan very large
103 portions of a network.
104
105 Wcd can also change to directories that are not in the treedata file.
106 E.g.:
107
108 wcd ..
109
110 If wcd found a match but can't change to the directory it tries to
111 remove it from the default treedata file. Not from the extra treedata
112 file. See also option -k.
113
114 Wcd keeps a directory stack which is stored on disk. The stack has a
115 default size of 10 and is cyclic. See options -z, -, + and =.
116
117 In multi-user environments option -u can be used to change to
118 directories of other users.
119
120 On DOS and Windows systems it does not matter if you use a slash "/" or
121 a backslash "\" as a directory separator.
122
123 It is possible on DOS and Windows systems to change drive and directory
124 in one go by preceding the directory name with the drive name.
125
126 wcd d:games
127
128 Windows UNC paths
129 The Windows versions (Command Prompt, PowerShell, MSYS, zsh, cygwin)
130 support Windows SMB LAN UNC paths without drive letter such as
131 "\\servername\sharename". Wcd for Windows Command Prompt makes use of
132 the "pushd" command to automatically map a UNC path to a drive letter.
133 In Windows PowerShell, MSYS, zsh and Cygwin UNC paths are fully
134 supported. The current working directory can be a UNC path.
135
136 Interfaces
137 Wcd has three different interfaces to choose from a list of matches.
138 The interface can be chosen at compile time.
139
140 The first interface uses plain stdin/stdout. A numbered list is printed
141 in the terminal. The user has to choose from the list by typing a
142 number followed by <Enter>. This interface does not provide scroll back
143 functionality in case of a long list. The scroll back capability of the
144 terminal/console has to be used. It is very small and portable.
145
146 The second interface is built with the conio library. It provides a
147 builtin scroll back capability. The user is presented a list numbered
148 with letters. Choosing from a list can be done by pressing just one
149 letter. This interface is fast because it saves keystrokes. If possible
150 the screen will be restored after exiting. One who prefers to type
151 numbers can use the -N option.
152
153 The third interface is built with the curses library. It is similar to
154 the conio interface. The curses version of wcd has also an additional
155 'graphical' interface. It lets the user select a directory via a full
156 screen interactive directory tree browser. It has a vim(1) like
157 navigation and search method. It can be activated with option -g.
158
159 By using the -o option one can always fall back to the stdin/stdout
160 interface.
161
163 -a Add current path to the default treedata file.
164
165 Use this option to quickly add the current path to the default
166 treedata file. Re-scanning the complete disk can take a long time
167 in some cases.
168
169 -aa Add current and all parent paths to the default treedata file.
170
171 -A PATH
172 Scan directory tree from PATH and append to the default treedata
173 file. Examples:
174
175 wcd -A .
176 wcd -A /home -A /etc
177 wcd -A d: -A e: -A \\server\share
178
179 On Windows one can scan all shared directories of a Windows LAN
180 server by typing something like: "wcd -A \\servername".
181
182 See also option -S and -s and -E.
183
184 -b Ban current path.
185
186 Wcd places the current path in the ban file. This means that wcd
187 ignores all matches of this directory and its sub directories.
188
189 The ban file can be edited with a text editor. Use of wildcards is
190 supported and names are matched against the absolute path.
191
192 Banned paths are not excluded from scanning the disk. To do that
193 use option -xf.
194
195 -c, --direct-cd
196 Direct CD mode. By default wcd works as follows:
197
198 1. Try to find a match in the treedata file(s)
199 2. If no match, try to open the directory you typed.
200
201 In direct CD mode wcd works in reversed order.
202
203 1. Try to open the directory you typed.
204 2. If not, try to find a match in the treedata file(s).
205
206 -d DRIVE
207 Set drive for stack and go file (DOS only).
208
209 The stack file and the go-script are by default stored on drive C:
210 if environment variable HOME is not set. Use this option if drive
211 C: is a read-only drive. This option must be used in front of the
212 stack options -, + and =.
213
214 -e Add current path to the extra treedata file.
215
216 Use this option to quickly add the current path to the extra
217 treedata file.
218
219 -ee Add current and all parent paths to extra treedata file.
220
221 -E PATH
222 Scan directory tree from PATH and append to Extra treedata file.
223 See also options -A and -S.
224
225 -f FILE
226 Read treedata file FILE. Do not read the default treedata file.
227
228 +f FILE
229 Read treedata file FILE in addition to the default treedata file.
230
231 -g Graphical interface (only in version with curses interface).
232
233 Wcd starts a textual curses based 'graphical' interface. The user
234 can select a directory via a full-screen interactive directory tree
235 browser. It has a vim(1) like navigation and search method.
236
237 If no search string is given wcd presents the whole tree which is
238 in the default treedata file and the extra treedata files.
239
240 If a search string is given the match list is presented as a
241 directory tree.
242
243 The default tree layout is similar to the tree layout of the
244 original NCD on DOS. The difference in layout is that in NCD all
245 directories of a same depth level were vertically aligned over the
246 whole tree. This was possible in NCD, because the maximum width of
247 a directory name in DOS was 12 (8.3) characters. On modern
248 operating systems directory names can be very long, so also the
249 differences in length can be large. Therefore folders with a same
250 depth are not vertically aligned over the whole tree in wcd, but
251 only in sub-branches. So there is some sideways movement when
252 moving straight up and down from one sub-branch to another sub-
253 branch.
254
255 The navigation behaviour in Wcd is exactly the same as in the
256 original NCD. For instance if you push the Down key you go down to
257 the next directory with the same depth level, jumping over
258 branches. This enables fast navigation through the tree.
259
260 See options -Ta, -TC, and -Tc to change the navigation behaviour.
261
262 -gd Dump the treedata files as a tree to stdout.
263
264 -G PATH
265 Write go-script in directory PATH. For instance on Unix, "wcd -G
266 PATH" will write a go-script PATH/wcd.go.
267
268 -GN, --no-go-script
269 Do not create go-script. This option can be used in combination
270 with the option -j if one does not want wcd to create a go-script.
271
272 -h, --help
273 Show help and exit.
274
275 -i, --ignore-case
276 Ignore case. Dos and Windows versions of wcd ignore case default.
277 Unix/Cygwin versions regard case by default.
278
279 +i, --no-ignore-case
280 Regard case. See also option -i.
281
282 -I, --ignore-diacritics
283 Ignore diacritics for Latin-based scripts. Letters with
284 diacritical marks match their base letter without diacritical mark.
285 The following Latin encodings are supported: CP437, CP850, CP852,
286 CP1250, CP1252, ISO-8859-1, ISO-8859-2, and Unicode Latin-1, Latin
287 Extended-A, and Latin Extended-B. See also
288 <http://en.wikipedia.org/wiki/Diacritic>
289
290 +I, --no-ignore-diacritics
291 Regard diacritics (default). See also option -I.
292
293 -j, --just-go
294 Just go mode.
295
296 In this mode wcd will not present a list when there is more than
297 one directory that matches the given directory. Wcd will just
298 change to the first option. When wcd is invoked again with the same
299 arguments it will change to the next option, and so on.
300
301 Wcd will print the directory to go to to stdout. So a different
302 installation method can be used. One could make the following
303 function for a POSIX compatible shell:
304
305 wcd ()
306 {
307 cd "$($HOME/bin/wcd.exe -j $@)"
308 }
309
310 When you are using an old shell that doesn't support "$()" command
311 substitution you have to use old style command substitution with
312 back-quotes.
313
314 wcd ()
315 {
316 cd "`$HOME/bin/wcd.exe -j $@`"
317 }
318
319 On Windows systems, if one is running 4NT shell, one could make the
320 following alias:
321
322 alias wcd `cd %@execstr[wcdwin32.exe -z 0 -j %1]`
323
324 This method eliminates the need of the go-script, so one can use
325 option -GN in combination with -j.
326
327 -k, --keep-paths
328 Keep paths.
329
330 Keep paths in the treedata file when wcd can't change to them. The
331 default behaviour of wcd is that it tries to remove paths from the
332 treedata when wcd can't change to them. With this option this
333 behavior is turned off.
334
335 -K, --color
336 Use colors in graphical mode.
337
338 -l ALIAS
339 Name the current path with ALIAS. Wcd places the current path with
340 alias ALIAS in the alias file. Aliases are case sensitive.
341
342 -ls Show the name of the alias file, and list all the aliases.
343
344 -m DIR
345 Make directory and add to treedata file.
346
347 -L, --license
348 Print the distribution license.
349
350 -M DIR
351 Make directory and add to extra treedata file.
352
353 -n PATH
354 Read relative treedata file from PATH.
355
356 Do not read the default treedata file. The relative treedata file
357 should already have been created using the wcd +S option. PATH may
358 also point to a file directly.
359
360 An example. Suppose another system has been mounted to mount point
361 "/mnt/network":
362
363 wcd -n /mnt/network src
364
365 Wcd opens the relative treedata file in "/mnt/network/". The file
366 contains the paths relative from that point.
367
368 +n PATH
369 Read relative treedata file in addition to the default treedata
370 file. See option -n.
371
372 -N, --numbers
373 Use numbers instead of letters.
374
375 Wcd with a conio or curses based interface (see section Interfaces)
376 presents a match list by default numbered with letters. When the -N
377 option is used the match list is numbered with numbers. Regardless
378 of the -N option one can type a letter or numbers to make a
379 selection from the list of matches.
380
381 -o Use stdin/stdout interface.
382
383 When for some kind of reason the conio or curses interface of wcd
384 does not work one can fall back to the stdin/stdout interface of
385 wcd by using the -o option.
386
387 -od, --to-stdout
388 Dump all matches to stdout.
389
390 -q, --quiet
391 Quieter operation. Printing of the final match is suppressed.
392
393 -r DIR
394 Remove directory and remove from the treedata file.
395
396 If the directory is empty, wcd will remove it, and try to remove it
397 from the treedata file.
398
399 -rmtree DIR
400 Recursively remove directory and remove from the treedata file.
401
402 Wcd will remove the directory and all its sub directories and
403 files, and remove the directories from the treedata file.
404
405 -s (re)Scan disk from $HOME directory. If HOME is not defined the disk
406 is scanned from root directory /.
407
408 The existing default treedata file is overwritten.
409
410 The default scan directory can be overruled with environment
411 variable "WCDSCAN". See section ENVIRONMENT VARIABLES.
412
413 -S PATH
414 Scan directory tree from PATH and overwrite the default treedata
415 file. See also options -A, -s and -E. E.g. with option -A you can
416 create a default treedata file of your choice. Examples:
417
418 Unix:
419
420 wcd -S /
421 wcd -S /home -A /etc -A /usr
422
423 DOS/Windows:
424
425 wcd -S c:/
426 wcd -S c: -A d: -A \\server\share
427
428 With the Windows versions one can scan all shared directories of a
429 Windows LAN server by typing something like: "wcd -S \\servername".
430
431 +S PATH
432 Scan disk from PATH and place relative paths in a relative treedata
433 file. This file is used by the -n and +n options of wcd. E.g. "wcd
434 -n PATH src".
435
436 -t Do not strip tmp mount dir "/tmp_mnt" (Unix only)
437
438 Wcd strips by default "/tmp_mnt/" from the match. Directory
439 "/tmp_mnt" is used by the auto-mounter. This behaviour can be
440 turned off with the -t option.
441
442 -T, --ascii-tree
443 Draw tree with ASCII characters. Use this option if line drawing
444 characters are not displayed properly in your terminal.
445
446 -Ta, --alt-tree-nav
447 Alternative way of navigation in the graphical tree.
448
449 In the default NCD style tree layout the -Ta option disables
450 jumping to unrelated directories.
451
452 In compact tree mode the alternative mode makes navigation similar
453 to navigation in GUI file managers such as Windows Explorer or
454 Linux KDE Konqueror. Pressing Up and Down moves the selected folder
455 one line up or down. Pressing Left first folds the sub-folders and
456 the next move left moves really left.
457
458 You can switch on-the-fly between default and alternative
459 navigation by pressing <Shift-A>.
460
461 When alternative navigation mode is on, you will see an "A" in the
462 lower right corner.
463
464 -TC, --center-tree
465 Centered view in the graphical tree. The selected directory stays
466 in the middle of the screen. The centered mode can also be switched
467 on and off with key <t> in the graphical tree.
468
469 The standard non-centered behaviour, which minimises tree movement,
470 is the same as in the original NCD.
471
472 -Tc, --compact-tree
473 By default the 'graphical' tree is drawn the same way as the
474 original NCD on DOS did it. On DOS a directory path could only be
475 66 characters in total. With the deep directory structures of today
476 the tree can become very wide. To overcome this wcd can draw the
477 tree in a compact way, similar to most GUI file managers, with only
478 one folder per line. Use option -Tc or switch on-the-fly with the
479 <m> key.
480
481 -Td, --cjk-width
482 Legacy East-Asian CJK (Chinese, Japanese, and Korean) fonts have
483 certain characters and line drawing symbols with a column width of
484 2, while the normal Unicode width for these characters is 1 column.
485 For instance the Chinese CP936 raster font on Windows and the
486 Simsun font. Use this option for a correct outlining of the
487 graphical tree when a legacy CJK font is used.
488
489 When CJK mode is on, you will see a "C" in the lower right corner.
490
491 -u USER
492 Scan treedata file of another user based on USER, do not scan your
493 own default treedata file. See also section ENVIRONMENT VARIABLES
494 for WCDUSERSHOME.
495
496 On Unix/Cygwin the base directory for user home directories is
497 assumed to be "/home". Wcd will look for "/home/USER/.treedata.wcd"
498 and "/home/USER/.wcd/.treedata.wcd", in that order, and read the
499 first one that exists and is readable. On DOS/Windows the base
500 directory for user home directories is assumed to be "\\users", so
501 wcd tries to read "\\users\USER\treedata.wcd" and
502 "\\users\USER\.wcd\treedata.wcd".
503
504 +u USER
505 Read default treedata file of USER in addition to your own treedata
506 file.
507
508 -v, --verbose
509 Display verbose messages. With this option wcd prints all filters,
510 bans and excludes.
511
512 -V, --version
513 Print version information and exit.
514
515 -w, --wild-match-only
516 Wild matching only. Treat all matches as wild matches.
517
518 -x PATH
519 Exclude PATH from scanning.
520
521 When this option is used wcd will exclude PATH and all its
522 subdirectories when wcd is scanning a disk. Wildcards are supported
523 and matched against absolute paths. Option -x can be used multiple
524 times.
525
526 wcd -x <path1> -x <path2> -s
527
528 Option -x must be used in front of any scan option (-s, -S, +S, -A,
529 -E).
530
531 On DOS/Windows systems one must specify the drive letter depending
532 on if environment variable HOME or WCDHOME is set. If HOME or
533 WCDHOME is set one needs to specify the drive letter. An example:
534
535 wcd -x c:/temp -S c:
536
537 Otherwise do not specify drive letter.
538
539 wcd -x /temp -s
540
541 -xf FILE
542 Exclude all paths listed in FILE from scanning.
543
544 When this option is used wcd will exclude all paths listed in FILE
545 and all their subdirectories when wcd is scanning a disk. Wildcards
546 are supported and they are matched against absolute paths; one path
547 per line. Be aware that wcd will not ignore leading or trailing
548 blanks on a line, because they are legal characters in a directory
549 name. Option -xf can be used multiple times. When one wants to
550 exclude all banned paths from scanning one can do the following
551 (example for wcd on unix):
552
553 wcd -xf ~/.ban.wcd -s
554
555 Wildcards are supported. For instance to exclude all your
556 Subversion directories with administrative files add a line with
557 "*/.svn".
558
559 Option -xf must be used in front of any scan option (-s, -S, +S,
560 -A, -E).
561
562 -y, --assume-yes
563 Assume Yes on all queries.
564
565 Wcd will not prompt the user with yes/no questions, but assumes the
566 user answers yes on all questions. This can be used in combination
567 with option -rmtree. This option must be used in front of options
568 that can lead to yes/no questions.
569
570 -z NUMBER
571 Set maximum stack size to NUMBER.
572
573 The default size of the stack is 10. Stack operation can be turned
574 off by setting the size to 0. This option must be used in front of
575 any other stack operations (-,+,=). Otherwise the size of the stack
576 will be set back to the default 10.
577
578 A correct command is:
579
580 wcd -z 50 -
581
582 The new stack size will be 50, wcd will go one directory back. A
583 wrong command is:
584
585 wcd - -z 50
586
587 Wcd goes one directory back, the stack gets the default size 10.
588 The -z 50 is ignored.
589
590 Add this option as the first option to your wcd alias or function.
591 E.g. for the a POSIX compatible shell this would be:
592
593 wcd ()
594 {
595 wcd.exe -z 50 "$@"
596 . ${WCDHOME:-${HOME}}/bin/wcd.go
597 }
598
599 -[NUMBER]
600 Push dir NUMBER of times. Default is one.
601
602 Go back a directory. Command "wcd -" goes one directory back. To go
603 more directories back add a number to it. E.g. command "wcd -3".
604 The stack is cyclic.
605
606 +[NUMBER]
607 Pop dir NUMBER of times. Default is one.
608
609 Go forward a directory. Command "wcd +" goes one directory forward.
610 To go more directories forward add a number to it. E.g. command
611 "wcd +2". The stack is cyclic.
612
613 = Show stack.
614
615 Use this option if you do not know anymore how many times to push
616 or pop. The stack is printed and you can choose a number. The
617 current place in the stack is marked with an asterisk "*".
618
620 The current working directory of a Unix shell can only be changed by
621 the builtin cd(1) command. Therefore the program is always called by a
622 function or an alias. The function or alias sources a shell script (go-
623 script) which is generated by the wcd program. Wcd can only work after
624 the function or alias is defined.
625
626 Another important influence on your installation is the definition of
627 environment variables HOME and WCDHOME. See section ENVIRONMENT
628 VARIABLES.
629
630 Install for POSIX type shells
631 For a POSIX shell (ksh, bash, zsh, etc.) on Unix, Linux, Cygwin, or
632 native MSYS add the following function to the shell startup file (e.g.
633 Bash uses "$HOME/.bashrc"):
634
635 wcd ()
636 {
637 PATH/wcd.exe "$@"
638 . ${WCDHOME:-${HOME}}/bin/wcd.go
639 }
640
641 Replace PATH with the location where the wcd executable has been
642 installed. Reload the shell initialization files or start new shell.
643
644 The location of the go-script "wcd.go" differs per shell.
645
646 Wcd for DJGPP DOS bash and OS/2 bash require a different function. The
647 go script is not written in a directory "bin", and if WCDHOME and HOME
648 are both not defined the go-script is written on c:/.
649
650 DOS bash:
651
652 wcd ()
653 {
654 PATH/wcdbash.exe "$@"
655 . ${WCDHOME:-${HOME:-"c:"}}/wcd.go
656 }
657
658 OS/2 bash:
659
660 wcd ()
661 {
662 PATH/wcdos2bash.exe "$@"
663 . ${WCDHOME:-${HOME:-"c:"}}/wcd.go
664 }
665
666 The WinZsh version of wcd requires a bit different function. The go-
667 script will never be written in c:/.
668
669 wcd ()
670 {
671 PATH/wcdwin32zsh.exe "$@"
672 . ${WCDHOME:-${HOME}}/wcd.go
673 }
674
675 See section FILES for more information.
676
677 Install for C-alike shells (csh, tcsh)
678 Add the following alias to the shell startup file "$HOME/.cshrc" or
679 "$HOME/.tcshrc" :
680
681 if ( ${?WCDHOME} ) then
682 alias wcd "PATH/wcd.exe \!* ; source $WCDHOME/bin/wcd.go"
683 else
684 alias wcd "PATH/wcd.exe \!* ; source $HOME/bin/wcd.go"
685 endif
686
687 Replace PATH with the location where the wcd executable has been
688 installed. Reload the shell initialization files or start a new shell.
689
690 Windows Command Prompt version
691 Unpack the zip file and add directory "bin" to your environment
692 variable PATH.
693
694 In Windows Command Prompt a Windows program cannot change the current
695 work directory, but a .bat file can. The batch script "wcd.bat" runs
696 the wcd program which generates a new batch script "wcdgo.bat". Then
697 "wcd.bat" runs "wcdgo.bat" which actually changes the directory.
698
699 Windows VISTA and higher
700 In a Windows VISTA and higher Command Prompt you may have limited
701 access to directories. To get access to more directories you need
702 administrator rights. You can get a Command Prompt with administrator
703 rights if you right click on the Command Prompt icon and select Run as
704 administrator.
705
706 Windows PowerShell version
707 Add the following function to your PowerShell user profile. The
708 location of this profile is stored in the $profile variable. It is
709 required that one of the environment variables HOME or WCDHOME is
710 defined.
711
712 function wcd
713 {
714 PATH\wcdwin32psh.exe $args
715 & $env:HOME\wcdgo.ps1
716 }
717
718 Replace PATH with the location where the wcd executable has been
719 installed. Start a new PowerShell. Wcd for PowerShell supports only
720 the file system provider. No other providers.
721
722 OS/2 Command Prompt version
723 In an OS/2 Command Prompt (cmd.exe) an OS/2-program can't change the
724 current work directory. That is why wcd generates a command script
725 "wcdgo.cmd" which must be executed in the current shell. The script
726 "wcd.cmd" first executes "wcdos2.exe", which creates the "wcdgo.cmd"
727 script. Then "wcd.cmd" executes the "wcdgo.cmd" script.
728
730 LANG
731 The primary language is selected with the environment variable
732 LANG. The LANG variable consists out of several parts. The first
733 part is in small letters the language code. The second one is
734 optional and is the country code in capital letters, preceded with
735 an underscore. There is also an optional third part: character
736 encoding, preceded with a dot. A few examples for POSIX standard
737 type shells:
738
739 export LANG=nl Dutch
740 export LANG=nl_NL Dutch, The Netherlands
741 export LANG=nl_BE Dutch, Belgium
742 export LANG=es_ES Spanish, Spain
743 export LANG=es_MX Spanish, Mexico
744 export LANG=en_US.iso88591 English, USA, Latin-1 encoding
745
746 For a complete list of language and country codes see the
747 gettext(1) manual:
748 <http://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes>
749 On Unix systems you can use to command locale(1) to get locale
750 specific information.
751
752 LANGUAGE
753 With the LANGUAGE environment variable you can specify a priority
754 list of languages, separated by colons. Wcd gives preference to
755 LANGUAGE over LANG. For instance, first Dutch and then German:
756 "LANGUAGE=nl:de". You have to first enable localization, by setting
757 LANG or LC_ALL to a value other than C, before you can use a
758 language priority list through the LANGUAGE variable. See also the
759 gettext(1) manual:
760 <http://www.gnu.org/software/gettext/manual/gettext.html#The-LANGUAGE-variable>
761
762 If you select a language which is not available you will get the
763 standard English messages.
764
765 WCDLOCALEDIR
766 With the environment variable WCDLOCALEDIR the LOCALEDIR used
767 during compilation and installation of wcd can be overruled.
768 LOCALEDIR is used by wcd with native language support to find the
769 language files. The GNU default value is "/usr/local/share/locale".
770 By typing "wcd -V" wcd will print the LOCALEDIR that is used.
771
772 If you have installed wcd in a different directory than the default
773 directory you may need to set the environment variable WCDLOCALEDIR
774 to point to the locale directory.
775
776 An example for Windows cmd:
777
778 set WCDLOCALEDIR=c:/my_prefix/share/locale
779
780 An example for a POSIX shell:
781
782 export WCDLOCALEDIR=$HOME/share/locale
783
784 LC_COLLATE
785 When there are multiple directory matches wcd presents a sorted
786 list. The sorting depends on the locale settings. If the
787 environment LANG has been set the matches are sorted like
788 dictionaries or phone books are sorted in that language. For
789 instance dots and dashes are ignored, or letters e with and without
790 accent are equal, or upper and lower case is ignored.
791
792 The sorting gives preference to environment variable LC_COLLATE
793 over LANG. If you make LC_COLLATE equal to "C" or "POSIX", locale
794 sorting is turned off. For instance if you want Dutch language, but
795 not Dutch sorting, you can do something like this:
796
797 export LANG=nl_NL
798 export LC_COLLATE=C
799
800 LC_CTYPE
801 With regard to character encoding Wcd will give preference to
802 variable LC_CTYPE over LANG. For instance to set character encoding
803 to UTF-8 the following environment setting can be done.
804
805 export LC_CTYPE=en_US.UTF-8
806
807 LC_ALL
808 All locale environment variables that start with LC_ are overruled
809 by the environment variable LC_ALL if it is defined. Wcd gives
810 preference to LC_ALL over LC_COLLATE and LC_CTYPE.
811
812 WINDOWS CODE PAGES
813 There are two groups of code pages: DOS code pages (OEM) and Windows
814 code pages (ANSI). The default encoding for Windows, when configured
815 with Western regional settings, is ANSI CP1252. Windows programs, for
816 instance notepad, use this default system ANSI code page. The Windows
817 console uses by default an OEM code page (CP437 or CP850) for
818 compatibility with DOS programs. If you use a DOS version of wcd in a
819 Windows console it will work, because of the DOS code page. But the
820 DOS version of wcd lacks support for long directory names and network
821 drives on Windows.
822
823 The Windows version of wcd is a native Windows program and will use the
824 Windows system ANSI code page. So on a Western regional Windows it will
825 use code page CP1252 for directory names and messages. In order to get
826 consistent output, independent of the active code page, all Windows
827 versions of Wcd translate ANSI output to Unicode output in the Command
828 Prompt and PowerShell.
829
830 The console raster font only supports the original OEM code page
831 installed with Windows, so you have to change the console's font to
832 true type Lucida Console to make Unicode (and ANSI) letters appear
833 correctly.
834
835 Non-Unicode versions of Wcd prior to version 5.2.0 use plain ANSI
836 output. For these older versions the code page of the console has to
837 be made equal to the system code page (changed to 1252) to make wcd for
838 Windows work properly with special characters such as accented
839 characters or the Euro symbol.
840
841 The Windows system code page can be changed via the Control Panel
842 regional options. The Windows console code page is changed with the
843 "chcp" command.
844
845 When you type "wcd -V", the actual character encoding used by wcd is
846 shown. Type the command "chcp" to display the active code page of the
847 Windows console.
848
849 UNICODE
850 Wcd has optional support for Unicode. To see if wcd was built with
851 Unicode support type "wcd -V". If your terminal/console and font
852 supports it, you should see the Euro symbol and Chinese characters
853 (meaning: "Chinese").
854
855 Wcd has been soft converted to Unicode. In its core wcd handles all
856 data as a stream of bytes. Only the lines printed to screen are on the
857 fly converted to Unicode wide characters. Wcd fully relies on libc
858 functions and has no UTF-8 specific code. See also
859 <http://www.cl.cam.ac.uk/~mgk25/unicode.html>
860
861 Wcd has optional support for Unicode matching with normalisation. To
862 find out whether Wcd has normalisation support type "wcd -V". Wcd with
863 Unicode normalization support will match Unicode names based on
864 compatible equivalence. Without Unicode normalization support, names
865 are matched when they are binary equivalent. See also
866 <http://en.wikipedia.org/wiki/Unicode_normalization>
867
868 UTF-8 on Unix/Linux
869
870 In order to view UTF-8 characters your console/terminal also needs to
871 support UTF-8. The xterm version that comes with XFree86 4.0 or higher
872 includes UTF-8 support. To activate it, start xterm(1) in a UTF-8
873 locale and use a font with iso10646-1 encoding, for instance with
874
875 LC_CTYPE=en_GB.UTF-8 xterm -u8 -fn '-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1'
876
877 Modern distributions of GNU/Linux support UTF-8 by default. Other
878 multi-byte character encodings should also work, but that has not been
879 tested.
880
881 Wcd assumes that the treedata files are encoded in the locale character
882 encoding. There are no Byte Order Marks written to treedata files.
883
884 UTF-16 on Windows
885
886 On Windows Unicode is supported in all versions of PowerShell, and in
887 Windows Command Prompt on Windows 7 (or higher). Unicode also works in
888 Take Command or TCC/LE made by JP Software, which can be used on older
889 Windows versions (XP/Vista).
890
891 On Windows all the directory names on disk are encoded in UTF-16
892 Unicode. For non-Unicode Windows programs the Unicode characters are
893 translated to the default ANSI code page. For characters that are not
894 part of the regional setting this translation is not possible and non-
895 Unicode programs print a question mark or a wrong character instead.
896
897 Wcd with Unicode support will read the UTF-16 encoded directory names
898 and converts them internally to UTF-8. All treedata files are encoded
899 in UTF-8 and not compatible with the non-Unicode version of Wcd. Wcd
900 will create a go-script encoded in UTF-8.
901
902 All versions of Windows PowerShell are able to run scripts encoded in
903 UTF-8, provided there is an UTF-8 BOM in the script.
904
905 Since Windows 7 it is possible in Windows Command Prompt to change
906 directory with a batch script to a directory with Unicode letters in
907 the name. The directory name needs to be encoded in UTF-8, and the
908 batch script must not have a BOM. The active code page of the Command
909 Prompt needs to be set to 65001 (UTF-8) prior to the cd command. Wcd
910 for Command Prompt will create such a go script "wcdgo.bat". It first
911 changes the code page to 65001, then changes directory, and finally
912 sets the code page back to the original code page.
913
914 You need to set the font to True Type Lucida Console (not raster font)
915 when letters don't appear correctly.
916
917 The non-Unicode Windows version of Wcd can read Unicode treedata files
918 since version 5.2.0, provided there is a Byte Order Mark (BOM) in the
919 file (see <http://en.wikipedia.org/wiki/Byte_order_mark>), but it can't
920 change to directories with Unicode letters in the name that are not
921 part of the default system ANSI code page. The Unicode Windows version
922 of wcd writes a BOM in the UTF-8 encoded treedata files since version
923 5.2.0, which makes them also readable by notepad.
924
925 UTF-8 on Cygwin
926
927 Cygwin supports Unicode since version 1.7. The Cygwin layer takes care
928 that the Windows UTF-16 Unicode names are converted to UTF-8. So
929 programs, like wcd, do not need to be aware of this and can operate
930 using UTF-8 encoding as on Unix/Linux. Set character encoding to UTF-8
931 with the LANG or LC_CTYPE environment variable. You may need to rescan
932 your drives. You need to set the font to True Type Lucida Console (not
933 raster font) if you use the default Cygwin console.
934
935 The Cygwin version behaves exactly as the Unix version of wcd. There
936 is no BOM written in the treedata files, and it is assumed they are
937 encoded in the Cygwin locale character encoding.
938
940 If the environment variable WCDHOME is set wcd will use WCDHOME instead
941 of HOME. All "*.wcd" files are text files. They can be edited with a
942 text editor. The Windows Command Prompt version of wcd behaves as the
943 DOS version. The Cygwin version of wcd behaves as the Unix version.
944
945 wcd.exe
946 The program. In Unix shells the program is always called by a
947 function or alias, because the current working directory of a Unix
948 shell can only be changed by the builtin cd command. See also
949 section INSTALLATION.
950
951 default treedata file
952 This is the default treedata file where wcd searches for matches.
953 If it is not readable wcd will create a new one.
954
955 DOS: \treedata.wcd or %HOME%\treedata.wcd
956 Unix: $HOME/.treedata.wcd
957
958 extra treedata file
959 An optional extra treedata file. If it exists and is readable wcd
960 will try to find matches in this file also.
961
962 DOS: \extra.wcd or %HOME%\extra.wcd
963 Unix: $HOME/.extra.wcd
964
965 ban file
966 In this optional file wcd places banned paths. See option -b.
967 Wildcards are supported.
968
969 DOS: \ban.wcd or %HOME%\ban.wcd
970 Unix: $HOME/.ban.wcd
971
972 alias file
973 Optional file with wcd aliases. See option -l.
974
975 DOS: \alias.wcd or %HOME%\alias.wcd
976 Unix: $HOME/.alias.wcd
977
978 stack file
979 In this file wcd stores its stack. The drive letter can be changed
980 with the -d option.
981
982 DOS: c:\stack.wcd or %HOME%\stack.wcd
983 Unix: $HOME/.stack.wcd
984
985 The name of the stack file can be changed with environment variable
986 WCDSTACKFILE. See section ENVIRONMENT VARIABLES.
987
988 go-script
989 This is the shell script which wcd.exe creates each time. It is
990 sourced via a function or an alias. The drive letter can be changed
991 with the -d option. For history reasons it is placed by default in
992 "$HOME/bin" on Unix systems. The directory of this file can be
993 changed with the option -G.
994
995 DOS bash: c:/wcd.go or $HOME/wcd.go
996 Windows Command Prompt: c:\wcdgo.bat or %HOME%\wcdgo.bat
997 Windows PowerShell: $env:HOME\wcdgo.ps1
998 WinZsh: $HOME/wcd.go
999 Cygwin/MSYS: $HOME/bin/wcd.go
1000 OS/2 Command Prompt: c:\wcdgo.cmd or %HOME%\wcdgo.cmd
1001 OS/2 bash: c:/wcd.go or $HOME/wcd.go
1002 Unix: $HOME/bin/wcd.go
1003
1004 relative treedata file
1005 Text file with relative paths from DIR. See options +S, -n and +n.
1006
1007 DOS: PATH\rtdata.wcd
1008 Unix: PATH/.rtdata.wcd
1009
1011 HOME
1012 Wcd uses by default environment variable HOME to determine where to
1013 store its files. See also section FILES. This can be overruled with
1014 environment variable WCDHOME.
1015
1016 HOME also defines where to start scanning the disk when option -s
1017 is used. This can be overruled with the environment variable
1018 WCDSCAN.
1019
1020 For the Unix, Cygwin, Windows PowerShell, WinZsh and MSYS version
1021 it is required that HOME or WCDHOME is set. For the other versions
1022 of wcd the use of these variables is optional.
1023
1024 If HOME is set on DOS/Windows, wcd will place all its files
1025 (treedata.wcd, extra.wcd, alias.wcd, ban.wcd, wcd.go) in directory
1026 HOME. The behaviour of wcd is then equal to the Unix version of
1027 wcd. Wcd will scan the disk default from HOME. Drives will not be
1028 automatically scanned by changing to them. You need to tell wcd
1029 explicitly. E.g.:
1030
1031 wcd -S c: -A d: -A e:
1032
1033 Matching of directories is now global over all scanned drives.
1034
1035 WCDHOME
1036 Environment variable WCDHOME can be used to change the location of
1037 wcd's files. If both HOME and WCDHOME are set, WCDHOME will be used
1038 instead of HOME.
1039
1040 In wcd versions prior to 5.1.5 WCDHOME also changed the default
1041 scan directory. This has changed. Since version 5.1.5 WCDHOME does
1042 not change the default scan directory. See option -s. From version
1043 5.1.5, use environment WCDSCAN to overrule the default scan
1044 directory.
1045
1046 Example for DOS, Windows, OS/2 Command Prompt:
1047
1048 set WCDHOME=C:\Users\erwin\wcd
1049
1050 An example for POSIX type shells:
1051
1052 export WCDHOME="$HOME/.wcd"
1053
1054 An example for Csh type shells:
1055
1056 setenv WCDHOME "$HOME/.wcd"
1057
1058 WCDSCAN
1059 Use environment variable WCDSCAN to overrule the default scan
1060 directory HOME. Define a colon separated list (Unix) to define more
1061 than one directory. On DOS/Windows make the list semi-colon
1062 separated.
1063
1064 Examples for DOS, Windows, OS/2 Command Prompt:
1065
1066 set WCDSCAN=C:\Users\erwin;D:\data
1067
1068 set WCDSCAN=%HOMEDRIVE%%HOMEPATH%;\\projectdrive\projectX
1069
1070 An example for POSIX type shells:
1071
1072 export WCDSCAN="$HOME:/projectdisk/projectX"
1073
1074 An example for Csh type shells:
1075
1076 setenv WCDSCAN "$HOME:/projectdisk/projectX"
1077
1078 WCDFILTER
1079 Specify filters with environment variable WCDFILTER. All
1080 directories that do not match the filter(s) are ignored. A list can
1081 be specified by separating filters by the shell path separator.
1082 Similar as specifying the PATH variable. The case sensitivity is
1083 mandated by the Operating system.
1084
1085 An example for DOS, Windows, OS/2 Command Prompt:
1086
1087 set WCDFILTER=projects;doc
1088
1089 An example for POSIX type shells:
1090
1091 export WCDFILTER="projects:doc"
1092
1093 An example for Csh type shells:
1094
1095 setenv WCDFILTER "projects:doc"
1096
1097 WCDBAN
1098 The paths specified with environment WCDBAN will be banned by wcd.
1099 See also option -b. Specify a list of paths separated by shell PATH
1100 separator.
1101
1102 WCDEXCLUDE
1103 The paths specified with environment WCDEXCLUDE will be excluded by
1104 wcd. See also options -x and -xf. Specify a list of paths separated
1105 by shell PATH separator.
1106
1107 An example for DOS, Windows, OS/2 Command Prompt:
1108
1109 set WCDEXCLUDE=*/windows;*/temp;*CVS
1110
1111 An example for POSIX type shells:
1112
1113 export WCDEXCLUDE="/dev:/tmp:*CVS"
1114
1115 An example for Csh type shells:
1116
1117 setenv WCDEXCLUDE "/dev:/tmp:*CVS"
1118
1119 WCDUSERSHOME
1120 Set the base of user's home directories. On DOS/Windows the
1121 default value is "\\users". On Unix/Cygwin the default value is
1122 "/home". This variable is used to scan treedata files of other
1123 users. See also options -u and +u. In verbose mode wcd will print
1124 all filters, bans and excludes. See option -v.
1125
1126 WCDSTACKFILE
1127 Wcd gives preference to WCDSTACKFILE over the default stack file
1128 name (see section FILES). With this variable each shell (or used
1129 terminal emulator) can have its private stack of used directories.
1130
1131 To use a unique time based YYYYMMDD-HHMMSS file for each opened
1132 interactive shell.
1133
1134 export WCDSTACKFILE=$HOME/.wcd/stack.$(date +%Y%m%d-%H%M%S)
1135
1136 For a stack per xterm(1), use the xterm WINDOWID environment
1137 variable:
1138
1139 export WCDSTACKFILE=$HOME/.wcd/stack.$WINDOWID
1140
1141 For GNU screen(1), to use stack per screen:
1142
1143 export WCDSTACKFILE=$HOME/.wcd/stack.$WINDOW
1144
1145 TERMINFO
1146 If the environment variable TERMINFO is defined, wcd with ncurses
1147 interface checks for a local terminal definition before checking in
1148 the standard place. This is useful if terminal definitions are not
1149 on a standard place. Often used standard places are
1150 "/usr/lib/terminfo" and "/usr/share/terminfo".
1151
1152 PDC_RESTORE_SCREEN
1153 Wcd with PDCurses interface recognizes the environment variable
1154 PDC_RESTORE_SCREEN. If this environment variable is set, PDCurses
1155 will take a copy of the contents of the screen at the time that wcd
1156 is started; when wcd exits, the screen will be restored. An
1157 example for Windows Command Prompt:
1158
1159 set PDC_RESTORE_SCREEN=1
1160
1161 Windows allows only a small buffer to be saved. So it is not always
1162 possible to restore everything. Some garbage data may be printed in
1163 the console after wcd exits if you have set a large buffer width.
1164
1165 SHELL
1166 Printing of "#!$SHELL" on the first line of the go-script for POSIX
1167 type shell or C shell is needed for 8 bit characters. Some shells
1168 otherwise think that the go-script is a binary file and will not
1169 source it. In Cygwin Bash the variable SHELL must be set in
1170 environment using the "export" command, otherwise wcd can't read
1171 the variable.
1172
1173 BASH
1174 Wcd for DOS bash uses $BASH instead of $SHELL, because $SHELL
1175 points to the DOS command shell. One may need to define $BASH with
1176 an "export" command, otherwise wcd can't read the variable.
1177
1179 sh(1), bash(1), csh(1), ksh(1), zsh(1), locale(1), ncurses(1),
1180
1182 Wcd was written by Erwin Waterlander <waterlan@xs4all.nl>
1183
1184 Project homepage: <http://waterlan.home.xs4all.nl/>
1185
1186 SourceForge: <http://sourceforge.net/projects/wcd/>
1187
1188 The manual page formatting was provided by Jari Aalto
1189 <jari.aalto@cante.net>.
1190
1191 NCD was originally written by Brad Kingsbury for Peter Norton's "Norton
1192 Utilities" around 1987. See also
1193 <http://www.softpanorama.org/OFM/norton_change_directory_clones.shtml>
1194
1195
1196
1197wcd 2018-05-10 wcd(1)