wcd(1)
π wcd(1) β bestie edition π
wcd β Wherever Change Directory. It's chdir for DOS and Unix, and it's about to become your whole personality. β¨
<div align="center">β</div>
πΈ SYNOPSIS πΈ
wcd [options] [directory]
π¦ DESCRIPTION π¦
π Overview π
Okay so. wcd is a command-line program that changes directory fast. It literally saves you from typing at the keyboard like some kind of Victorian ghost. You only type a part of a directory name and wcd justβ¦ jumps there. Main character energy. π
When there's multiple matches it has a fast selection method, plus it lets you alias and ban directories. And it also ships with a full screen interactive directory tree browser with speed search. It's giving everything, fr fr.
wcd was modeled after Norton Change Directory (NCD). NCD first appeared in The Norton Utilities, Release 4, for DOS in 1987, published by Peter Norton. History queen. π
wcd has been ported to a bunch of different command-line shells:
- DOS
command.com - Windows
cmd.exeandPowerShell - OS/2
cmd.exe - Unix shells such as Bourne (
sh), Bourne Again (bash), Korn (ksh), Z (zsh), and C (csh) shell - and others running on any operating system
wcd supports 8 bit character sets on all systems, and has optional support for Unicode. See section LOCALIZATION.
See section INSTALLATION for how to set wcd up for personal use. π
π Basic use π
By default β like, if no wildcards are used β wcd searches for a directory with a name that begins with the name you typed.
For instance, this command changes to the directory of the current user's /home/user/Desktop:
wcd Desk
When there's multiple matches, wcd will present you a list of all the matches. Then you make a selection with a few keystrokes (most of the time just one, because slay).
π§ Wildcards π§
wcd supports these wildcards, bestie:
*β matches any sequence of characters (zero or more)?β matches any character[SET]β matches any character in the specified set,[!SET]or[^SET]β matches any character not in the specified set.
A set is composed of characters or ranges; a range looks like character hyphen character, as in "0-9" or "A-Z". The [0-9a-zA-Z_] is the minimal set of characters allowed in the [..] pattern construct. International characters (i.e. 8 bit characters) are allowed if the system supports them. To suppress the special syntactic significance of any of []*?!^-\ inside or outside a [..] construct, and match the character exactly, precede the character with a backslash (\) marker.
Using wildcards makes powerful searching possible. For instance this matches any directory name that ends with "top":
wcd *top
Match directories that have "top" anywhere in the name:
wcd *top*
Match any directory name that begins with "a", "b" or "c":
wcd [a-c]*
It's also possible to give a part of a directory path. Here wcd searches for a directory that begins with "Desk" and which path matches *me/Desk*.
wcd me/Desk
And literally any kind of expression with slashes and wildcards is allowed. E.g.:
wcd src*/*1?/a*2
π Other uses π
If no wildcards are used and wcd finds a perfect match, wcd will ignore all wild matches by default. You can change this behaviour with the -w option.
The interactive directory tree browser can be started by using option -g.
wcd -g
wcd generates a treedata file where it searches the directory. On Unix and Windows systems wcd does add symbolic links to the treedata file while scanning the disk, but it does not follow them. While following links wcd could end up scanning infinite loops, or scan very large portions of a network. π
wcd can also change to directories that are not in the treedata file. E.g.:
wcd ..
If wcd found a match but can't change to the directory, it tries to remove it from the default treedata file. Not from the extra treedata file. See also option -k.
wcd keeps a directory stack which is stored on disk. The stack has a default size of 10 and is cyclic. See options -z, -, + and =.
In multi-user environments, option -u can be used to change to directories of other users.
On DOS and Windows systems it does not matter if you use a slash / or a backslash \ as a directory separator.
It's possible on DOS and Windows systems to change drive and directory in one go by preceding the directory name with the drive name.
wcd d:games
π«Ά Windows UNC paths π«Ά
The Windows versions (Command Prompt, PowerShell, MSYS, zsh, cygwin) support Windows SMB LAN UNC paths without drive letter such as "\\servername\sharename". wcd for Windows Command Prompt makes use of the "pushd" command to automatically map a UNC path to a drive letter. In Windows PowerShell, MSYS, zsh and Cygwin, UNC paths are fully supported. The current working directory can be a UNC path. π
π Console resizing on Windows π
wcd supports console resizing in Windows 10 console and ConEmu (see <https://conemu.github.io/>) since version 6.0.3.
The Windows 10 console must not be in legacy mode (check the console's properties).
The screen may not refresh when the console Layout property "Wrap text output on resize" is disabled. The screen can be refreshed manually by pressing the F5 key.
β Interfaces β
wcd has three different interfaces to choose from a list of matches. The interface can be chosen at compile time.
- The first interface uses plain
stdin/stdout. A numbered list is printed in the terminal. You have to choose from the list by typing a number followed by Enter. This interface does not provide scroll back functionality in case of a long list β you have to use the scroll back capability of the terminal/console. It is very small and portable. Tiny icon. π - The second interface is built with the conio library. It provides a builtin scroll back capability. You're presented a list numbered with letters, and choosing from the list can be done by pressing just one letter. This interface is fast because it saves keystrokes. If possible the screen will be restored after exiting. If you prefer to type numbers you can use the
-Noption. - The third interface is built with the curses library. It's similar to the conio interface. The curses version of wcd has also an additional 'graphical' interface. It lets you select a directory via a full screen interactive directory tree browser. It has a
vim(1)like navigation and search method. It can be activated with option-g.
By using the -o option one can always fall back to the stdin/stdout interface. Options are forever. π
β¨ OPTIONS β¨
-aβ Add current path to the default treedata file.
Use this option to quickly add the current path to the default treedata file. Re-scanning the complete disk can take a long time in some cases. Like, a long time. π
-aaβ Add current and all parent paths to the default treedata file.-APATH β Scan directory tree from PATH and append to the default treedata file. Examples:
wcd -A .
wcd -A /home -A /etc
wcd -A d: -A e: -A \\server\share
On Windows one can scan all shared directories of a Windows LAN server by typing something like: "wcd -A \\servername".
See also option -S and -s and -E.
-bβ Ban current path.
wcd places the current path in the ban file. This means that wcd ignores all matches of this directory and its sub directories. Bye bestie, blocked. π«
The ban file can be edited with a text editor. Use of wildcards is supported and names are matched against the absolute path.
Banned paths are not excluded from scanning the disk. To do that use option -xf.
-c,--direct-cdβ Direct CD mode. By default wcd works as follows:- Try to find a match in the treedata file(s)
- If no match, try to open the directory you typed.
In direct CD mode wcd works in reversed order.
- Try to open the directory you typed.
- If not, try to find a match in the treedata file(s).
-dDRIVE β Set drive for stack and go file (DOS only).
The stack file and the go-script are by default stored on drive C: if environment variable HOME is not set. Use this option if drive C: is a read-only drive. This option must be used in front of the stack options -, + and =.
-eβ Add current path to the extra treedata file.
Use this option to quickly add the current path to the extra treedata file.
-eeβ Add current and all parent paths to extra treedata file.-EPATH β Scan directory tree from PATH and append to Extra treedata file. See also options-Aand-S.-fFILE β Read treedata file FILE. Do not read the default treedata file.+fFILE β Read treedata file FILE in addition to the default treedata file.-gβ Graphical interface (only in version with curses interface). π
wcd starts a textual curses based 'graphical' interface. You can select a directory via a full-screen interactive directory tree browser. It has a vim(1) like navigation and search method.
If no search string is given, wcd presents the whole tree which is in the default treedata file and the extra treedata files.
If a search string is given, the match list is presented as a directory tree.
The default tree layout is similar to the tree layout of the original NCD on DOS. The difference in layout is that in NCD all directories of a same depth level were vertically aligned over the whole tree. This was possible in NCD, because the maximum width of a directory name in DOS was 12 (8.3) characters. On modern operating systems directory names can be very long, so also the differences in length can be large. Therefore folders with a same depth are not vertically aligned over the whole tree in wcd, but only in sub-branches. So there is some sideways movement when moving straight up and down from one sub-branch to another sub-branch.
The navigation behaviour in wcd is exactly the same as in the original NCD. For instance if you push the Down key you go down to the next directory with the same depth level, jumping over branches. This enables fast navigation through the tree. Speed. π¦
See options -Ta, -TC, and -Tc to change the navigation behaviour.
-gdβ Dump the treedata files as a tree tostdout.-GPATH β Write go-script in directory PATH. For instance on Unix,"wcd -G PATH"will write a go-scriptPATH/wcd.go.-GN,--no-go-scriptβ Do not create go-script. This option can be used in combination with the option-jif one does not want wcd to create a go-script.-h,--helpβ Show help and exit.-i,--ignore-caseβ Ignore case. Dos and Windows versions of wcd ignore case by default. Unix/Cygwin versions regard case by default.+i,--no-ignore-caseβ Regard case. See also option-i.
β¦and that's only part one, bestie β there's more coming, don't go anywhere π«Ά
-I,--ignore-diacriticsβ bestie, this one makes wcd stop caring about diacritics for Latin-based scripts π . Letters rockin' a diacritical mark will match their base letter without it. The Latin encodings getting this treatment are:CP437,CP850,CP852,CP1250,CP1252,ISO-8859-1,ISO-8859-2, plus Unicode Latin-1, Latin Extended-A, and Latin Extended-B. Peep also <http://en.wikipedia.org/wiki/Diacritic> π+I,--no-ignore-diacriticsβ actually do care about diacritics, which is the default, no cap. Slide over to option-Ifor the other vibe β¨-j,--just-goβ Just go mode π
So here's the tea: in this mode wcd will not hit you with a list when more than one directory matches what you asked for. It's give-no-options energy β wcd just changes to the first option. And when you invoke wcd again with the same arguments, it changes to the next option, and so on. Periodt.
wcd prints the directory it's going to, straight to stdout, which means you can install the whole thing a different way. One could make this function for a POSIX compatible shell:
wcd ()
{
cd "$($HOME/bin/wcd.exe -j $@)"
}
And if you're on an old shell that doesn't support "$()" command substitution, you gotta use the old style command substitution with back-quotes:
wcd ()
{
cd "`$HOME/bin/wcd.exe -j $@`"
}
On Windows systems, if you're running the 4NT shell, you could make this alias:
alias wcd `cd %@execstr[wcdwin32.exe -z 0 -j %1]`
This method eliminates the need for the go-script, so you can use option -GN in combination with -j π₯
-k,--keep-pathsβ keep paths π«Ά
This keeps paths in the treedata file when wcd can't change to them. The default behaviour of wcd is that it tries to remove paths from the treedata when wcd can't change to them β this option turns that behavior off. Lowkey protective, honestly.
-K,--colorβ use colors in graphical mode π aesthetic unlocked.-l ALIASβ name the current path with ALIAS. wcd places the current path with alias ALIAS in the alias file. Heads up: aliases are case sensitive π-lsβ show the name of the alias file, and list all the aliases. It's giving "let me show you around" πΈ-m DIRβ make directory and add to treedata file.-L,--licenseβ print the distribution license π-M DIRβ make directory and add to extra treedata file.-n PATHβ read relative treedata file from PATH.
Do not read the default treedata file. The relative treedata file should already have been created using the wcd +S option. PATH may also point to a file directly.
An example, bestie. Suppose another system has been mounted to mount point "/mnt/network":
wcd -n /mnt/network src
wcd opens the relative treedata file in "/mnt/network/". That file contains the paths relative from that point π«
+n PATHβ read relative treedata file in addition to the default treedata file. See option-n.-N,--numbersβ use numbers instead of letters π’
wcd with a conio or curses based interface (see section Interfaces) presents a match list by default numbered with letters. When the -N option is used, the match list is numbered with numbers. And regardless of the -N option, you can type a letter or numbers to make a selection from the list of matches. So flexible, so iconic.
-oβ use stdin/stdout interface.
When for some kind of reason the conio or curses interface of wcd does not work, you can fall back to the stdin/stdout interface of wcd by using the -o option. Backup plan energy π
-od,--to-stdoutβ dump all matches to stdout.-q,--quietβ quieter operation. Printing of the final match is suppressed π€«-r DIRβ remove directory and remove from the treedata file.
If the directory is empty, wcd will remove it, and try to remove it from the treedata file.
-rmtree DIRβ recursively remove directory and remove from the treedata file.
wcd will remove the directory and all its sub directories and files, and remove the directories from the treedata file. That's the whole tree, babes β no survivors π³
-sβ (re)Scan disk from$HOMEdirectory. IfHOMEis not defined, the disk is scanned from root directory/.
The existing default treedata file is overwritten.
The default scan directory can be overruled with environment variable "WCDSCAN". See section ENVIRONMENT VARIABLES β¨
-S PATHβ scan directory tree from PATH and overwrite the default treedata file. See also options-A,-sand-E. E.g. with option-Ayou can create a default treedata file of your choice. Examples:
Unix:
wcd -S /
wcd -S /home -A /etc -A /usr
DOS/Windows:
wcd -S c:/
wcd -S c: -A d: -A \\server\share
With the Windows versions one can scan all shared directories of a Windows LAN server by typing something like: "wcd -S \\servername" π₯
+S PATHβ scan disk from PATH and place relative paths in a relative treedata file. This file is used by the-nand+noptions of wcd. E.g."wcd -n PATH src".-tβ do not strip tmp mount dir"/tmp_mnt"(Unix only) π§
wcd strips by default "/tmp_mnt/" from the match. Directory "/tmp_mnt" is used by the auto-mounter. This behaviour can be turned off with the -t option.
-T,--ascii-treeβ draw tree with ASCII characters. Use this option if line drawing characters are not displayed properly in your terminal. Retro vibes π¦-Ta,--alt-tree-navβ alternative way of navigation in the graphical tree.
In the default NCD style tree layout the -Ta option disables jumping to unrelated directories.
In compact tree mode the alternative mode makes navigation similar to navigation in GUI file managers such as Windows Explorer or Linux KDE Konqueror. Pressing Up and Down moves the selected folder one line up or down. Pressing Left first folds the sub-folders and the next move left moves really left.
You can switch on-the-fly between default and alternative navigation by pressing Shift+A.
When alternative navigation mode is on, you will see an "A" in the lower right corner π
-TC,--center-treeβ centered view in the graphical tree. The selected directory stays in the middle of the screen. The centered mode can also be switched on and off with key t in the graphical tree.
The standard non-centered behaviour, which minimises tree movement, is the same as in the original NCD π
-Tc,--compact-treeβ by default the 'graphical' tree is drawn the same way as the original NCD on DOS did it. On DOS a directory path could only be 66 characters in total. With the deep directory structures of today the tree can become very wide. To overcome this, wcd can draw the tree in a compact way, similar to most GUI file managers, with only one folder per line. Use option-Tcor switch on-the-fly with the m key π-Td,--cjk-widthβ legacy East-Asian CJK (Chinese, Japanese, and Korean) fonts have certain characters and line drawing symbols with a column width of 2, while the normal Unicode width for these characters is 1 column. For instance the ChineseCP936raster font on Windows and theSimsunfont. Use this option for a correct outlining of the graphical tree when a legacy CJK font is used.
When CJK mode is on, you will see a "C" in the lower right corner β¨
-u USERβ scan treedata file of another user based on USER, do not scan your own default treedata file. See also section ENVIRONMENT VARIABLES forWCDUSERSHOME.
On Unix/Cygwin the base directory for user home directories is assumed to be "/home". wcd will look for "/home/USER/.treedata.wcd" and "/home/USER/.wcd/.treedata.wcd", in that order, and read the first one that exists and is readable. On DOS/Windows the base directory for user home directories is assumed to be "\\users", so wcd tries to read "\\users\USER\treedata.wcd" and "\\users\USER\.wcd\treedata.wcd" π
+u USERβ read default treedata file of USER in addition to your own treedata file. Sharing is caring π«Ά-v,--verboseβ display verbose messages. With this option wcd prints all filters, bans and excludes. Spill everything, bestie π£οΈ-V,--versionβ print version information and exit.-w,--wild-match-onlyβ wild matching only. Treat all matches as wild matches π-x PATHβ exclude PATH from scanning.
When this option is used wcd will exclude PATH and all its subdirectories when wcd is scanning a disk. Wildcards are supported and matched against absolute paths. Option -x can be used multiple times.
wcd -x <path1> -x <path2> -s
Option -x must be used in front of any scan option (-s, -S, +S, -A, -E).
On DOS/Windows systems one must specify the drive letter depending on if environment variable HOME or WCDHOME is set. If HOME or WCDHOME is set, one needs to specify the drive letter. An example:
wcd -x c:/temp -S c:
Otherwise do not specify drive letter.
wcd -x /temp -s
-xf FILEβ exclude all paths listed in FILE from scanning.
When this option is used wcd will exclude all paths listed in FILE and all their subdirectories when wcd is scanning a disk. Wildcards are supported and they are matched against absolute paths; one path per line. Be aware that wcd will not ignore leading or trailing blanks on a line, because they are legal characters in a directory name. Option -xf can be used multiple times. When one wants to exclude all banned paths from scanning one can do the following (example for wcd on unix):
wcd -xf ~/.ban.wcd -s
Wildcards are supported. For instance to exclude all your Subversion directories with administrative files, add a line with "*/.svn".
Option -xf must be used in front of any scan option (-s, -S, +S, -A, -E).
-y,--assume-yesβ assume Yes on all queries π
wcd will not prompt the user with yes/no questions, but assumes the user answers yes on all questions. This can be used in combination with option -rmtree. This option must be used in front of options that can lead to yes/no questions. π¨
-z NUMBERβ set maximum stack size to NUMBER.
The default size of the stack is 10. Stack operation can be turned off by setting the size to 0. This option must be used in front of any other stack operations (-,+,=). Otherwise the size of the stack will be set back to the default 10.
A correct command is:
wcd -z 50 -
The new stack size will be 50, wcd will go one directory back. A wrong command is:
wcd - -z 50
So basically wcd does one directory back, and the stack gets the default size 10. And the -z 50? Yeah, that one just gets ignored here. π
Add this option as the first option to your wcd alias or function. Like, for a POSIX compatible shell it'd look like this:
wcd ()
{
wcd.exe -z 50 "$@"
. ${WCDHOME:-${HOME}}/bin/wcd.go
}
-[NUMBER]β push dir NUMBER times. Default is one.
Go back a directory, bestie. Command wcd - goes one directory back. Wanna go more directories back? Just add a number to it, like command wcd -3. And plot twist: the stack is cyclic. π
+[NUMBER]β pop dir NUMBER times. Default is one.
Go forward a directory. Command wcd + goes one directory forward. To go more directories forward add a number, e.g. command wcd +2. Yep, cyclic here too. π
=β show stack.
Use this option if you literally do not know anymore how many times to push or pop (been there π). The stack gets printed and you can choose a number. The current place in the stack is marked with an asterisk "*". β
π INSTALLATION π
Okay so here's the tea, and it's important: the current working directory of a Unix shell can only be changed by the builtin cd(1) command. That's just the rules. So the program is always called by a function or an alias. That function or alias sources a shell script (the go-script) which is generated by the wcd program. Meaning: wcd can only work after the function or alias is defined. No function, no vibes. π«Ά
Another important influence on your installation is the definition of the environment variables HOME and WCDHOME. Peep the section ENVIRONMENT VARIABLES for that. π
β¨ Install for POSIX type shells β¨
If wcd was installed with a package manager, the wcd function may be installed in /etc/profile.d and automatically sourced. In that case you do not need to define a function yourself. Slay, less work for you. π
For a POSIX shell (ksh, bash, zsh, etc.) on Unix, Linux, Cygwin, or native MSYS, add the following function to the shell startup file (e.g. Bash uses "$HOME/.bashrc"):
wcd ()
{
typeset go="${WCDHOME:-${HOME}}/bin/wcd.go"
rm -f "$go" 2> /dev/null
PATH/wcd.exe "$@"
[ -f "$go" ] && . "$go"
}
Replace PATH with the location where the wcd executable has been installed. Then reload the shell initialization files or start a new shell. β¨
The location of the go-script "wcd.go" differs per shell. π¦
wcd for DJGPP DOS bash and OS/2 bash require a different function. The go script is not written in a directory "bin", and if WCDHOME and HOME are both not defined, the go-script is written on c:/.
DOS bash:
wcd ()
{
PATH/wcdbash.exe "$@"
. ${WCDHOME:-${HOME:-"c:"}}/wcd.go
}
OS/2 bash:
wcd ()
{
PATH/wcdos2bash.exe "$@"
. ${WCDHOME:-${HOME:-"c:"}}/wcd.go
}
The WinZsh version of wcd requires a bit different function. The go-script will never be written in c:/.
wcd ()
{
PATH/wcdwin32zsh.exe "$@"
. ${WCDHOME:-${HOME}}/wcd.go
}
See section FILES for more info. π
πΈ Install for C-alike shells (csh, tcsh) πΈ
Add the following alias to the shell startup file "$HOME/.cshrc" or "$HOME/.tcshrc":
if ( ${?WCDHOME} ) then
alias wcd "PATH/wcd.exe \!* ; source $WCDHOME/bin/wcd.go"
else
alias wcd "PATH/wcd.exe \!* ; source $HOME/bin/wcd.go"
endif
Replace PATH with the location where the wcd executable has been installed. Reload the shell initialization files or start a new shell. π
π¦ Windows Command Prompt version π¦
Unpack the zip file and add directory "bin" to your environment variable PATH.
In Windows Command Prompt a Windows program cannot change the current work directory, but a .bat file can. The batch script "wcd.bat" runs the wcd program which generates a new batch script "wcdgo.bat". Then "wcd.bat" runs "wcdgo.bat" which actually changes the directory. Sneaky but iconic. π₯
π Windows VISTA and higher π
In a Windows VISTA and higher Command Prompt you may have limited access to directories. To get access to more directories you need administrator rights. You can get a Command Prompt with administrator rights if you right click on the Command Prompt icon and select Run as administrator. Periodt. π
π Windows PowerShell version π
Add the following function to your PowerShell user profile. The location of this profile is stored in the $profile variable. It is required that one of the environment variables HOME or WCDHOME is defined.
function wcd
{
PATH\wcdwin32psh.exe $args
& $env:HOME\wcdgo.ps1
}
Replace PATH with the location where the wcd executable has been installed. Start a new PowerShell. And heads up bestie: wcd for PowerShell supports only the file system provider. No other providers. π
π OS/2 Command Prompt version π
In an OS/2 Command Prompt (cmd.exe) an OS/2-program can't change the current work directory. That is why wcd generates a command script "wcdgo.cmd" which must be executed in the current shell. The script "wcd.cmd" first executes "wcdos2.exe", which creates the "wcdgo.cmd" script. Then "wcd.cmd" executes the "wcdgo.cmd" script. Chef's kiss coordination honestly. π§
β¨ LOCALIZATION β¨
Okay bestie, this section is the "wcd speaks your language" section and it's honestly so iconic. Let's get into it. ππ
π£οΈ LANG
Your primary language gets picked from the environment variable LANG. That's the one doing all the heavy lifting by default.
And LANG isn't just one blob of text β it's got parts, like a little passport for your locale:
- The first part is the language code, in small letters.
- The second part is optional, and it's the country code in capital letters, with an underscore
_in front of it. - The third part is also optional β that's the character encoding, and it gets a dot
.in front of it.
A few examples, written for POSIX standard type shells:
export LANG=nl Dutch
export LANG=nl_NL Dutch, The Netherlands
export LANG=nl_BE Dutch, Belgium
export LANG=es_ES Spanish, Spain
export LANG=es_MX Spanish, Mexico
export LANG=en_US.iso88591 English, USA, Latin-1 encoding
For a complete list of language and country codes, go peek at the gettext(1) manual: <http://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes>
And on Unix systems you can use the command locale(1) to get locale specific information. Slay. π
π¬ LANGUAGE
With the LANGUAGE environment variable you can specify a priority list of languages, separated by colons. Wcd gives preference to LANGUAGE over LANG. So for instance, first Dutch and then German would be "LANGUAGE=nl:de".
Heads up bestie: you have to first enable localization, by settingLANGorLC_ALLto a value other thanC, before you can use a language priority list through theLANGUAGEvariable. It's giving "you gotta turn it on first."
See also the gettext(1) manual: <http://www.gnu.org/software/gettext/manual/gettext.html#The-LANGUAGE-variable>
And if you select a language which is not available? You'll just get the standard English messages. No drama, no crash, just plain English. π
π WCDLOCALEDIR
With the environment variable WCDLOCALEDIR the LOCALEDIR used during compilation and installation of wcd can be overruled. LOCALEDIR is what wcd uses, with native language support, to find the language files. The GNU default value is "/usr/local/share/locale". And by typing wcd -V wcd will print the LOCALEDIR that is used. Cute, right? It tells on itself. π«Ά
If you installed wcd in a different directory than the default directory, you may need to set the environment variable WCDLOCALEDIR to point to the locale directory.
An example for Windows cmd:
set WCDLOCALEDIR=c:/my_prefix/share/locale
An example for a POSIX shell:
export WCDLOCALEDIR=$HOME/share/locale
π€ LC_COLLATE
When there are multiple directory matches, wcd presents a sorted list. The sorting depends on the locale settings, okay? So if the environment LANG has been set, the matches are sorted like dictionaries or phone books are sorted in that language. Which, iconically, means stuff like:
- dots and dashes are ignored, or
- letters e with and without accent are equal, or
- upper and lower case is ignored.
The sorting gives preference to environment variable LC_COLLATE over LANG. If you make LC_COLLATE equal to "C" or "POSIX", locale sorting is turned off. So if you want Dutch language, but not Dutch sorting, you can do something like this:
export LANG=nl_NL
export LC_COLLATE=C
Main character energy: language and sorting don't have to match. You can mix and match. π
π‘ LC_CTYPE
With regard to character encoding, Wcd will give preference to variable LC_CTYPE over LANG. So for instance, to set character encoding to UTF-8, the following environment setting can be done:
export LC_CTYPE=en_US.UTF-8
π LC_ALL
All locale environment variables that start with LC_ are overruled by the environment variable LC_ALL if it is defined. Wcd gives preference to LC_ALL over LC_COLLATE and LC_CTYPE. She's the final boss, the one who overrules everyone. Periodt. π
πͺ WINDOWS CODE PAGES
There are two groups of code pages, bestie: DOS code pages (OEM) and Windows code pages (ANSI). Keep them straight, okay?
The default encoding for Windows, when configured with Western regional settings, is ANSI CP1252. Windows programs, for instance notepad, use this default system ANSI code page. Meanwhile the Windows console uses by default an OEM code page (CP437 or CP850) for compatibility with DOS programs. If you use a DOS version of wcd in a Windows console it will work, because of the DOS code page. But β and this is the sad part π β the DOS version of wcd lacks support for long directory names and network drives on Windows.
The Windows version of wcd is a native Windows program and will use the Windows system ANSI code page. So on a Western regional Windows it will use code page CP1252 for directory names and messages. In order to get consistent output, independent of the active code page, all Windows versions of Wcd translate ANSI output to Unicode output in the Command Prompt and PowerShell. β¨
Now here's a font thing that trips everyone up: the console raster font only supports the original OEM code page installed with Windows, so you have to change the console's font to true type Lucida Console to make Unicode (and ANSI) letters appear correctly. Not a vibe otherwise. π
Non-Unicode versions of Wcd prior to version 5.2.0 use plain ANSI output. For these older versions the code page of the console has to be made equal to the system code page (changed to 1252) to make wcd for Windows work properly with special characters such as accented characters or the Euro symbol.
The Windows system code page can be changed via the Control Panel regional options. The Windows console code page is changed with the "chcp" command.
When you type "wcd -V", the actual character encoding used by wcd is shown. Type the command "chcp" to display the active code page of the Windows console.
π UNICODE
Wcd has optional support for Unicode. To see if wcd was built with Unicode support type "wcd -V". If your terminal/console and font supports it, you should see the Euro symbol and Chinese characters (meaning: "Chinese"). That's how you know. π
Wcd has been soft converted to Unicode. In its core, wcd handles all data as a stream of bytes. Only the lines printed to screen are on the fly converted to Unicode wide characters. Wcd fully relies on libc functions and has no UTF-8 specific code. See also <http://www.cl.cam.ac.uk/~mgk25/unicode.html>
Wcd also has optional support for Unicode matching with normalisation. To find out whether Wcd has normalisation support type "wcd -V". Wcd with Unicode normalization support will match Unicode names based on compatible equivalence. Without Unicode normalization support, names are matched when they are binary equivalent. See also <http://en.wikipedia.org/wiki/Unicode_normalization>
π UTF-8 on Unix/Linux
In order to view UTF-8 characters your console/terminal also needs to support UTF-8. The xterm version that comes with XFree86 4.0 or higher includes UTF-8 support. To activate it, start xterm(1) in a UTF-8 locale and use a font with iso10646-1 encoding, for instance with:
LC_CTYPE=en_GB.UTF-8 xterm -u8 -fn '-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1'
Modern distributions of GNU/Linux support UTF-8 by default. Other multi-byte character encodings should also work, but that has not been tested. No cap.
Wcd assumes that the treedata files are encoded in the locale character encoding. There are no Byte Order Marks written to treedata files.
π¦ UTF-16 on Windows
On Windows, Unicode is supported in all versions of PowerShell, and in Windows Command Prompt on Windows 7 (or higher). Unicode also works in Take Command or TCC/LE made by JP Software, which can be used on older Windows versions (XP/Vista).
On Windows all the directory names on disk are encoded in UTF-16 Unicode. For non-Unicode Windows programs the Unicode characters are translated to the default ANSI code page. For characters that are not part of the regional setting, this translation is not possible, and non-Unicode programs print a question mark or a wrong character instead. It's giving π energy.
Wcd with Unicode support will read the UTF-16 encoded directory names and converts them internally to UTF-8. All treedata files are encoded in UTF-8 and not compatible with the non-Unicode version of Wcd. Wcd will create a go-script encoded in UTF-8.
All versions of Windows PowerShell are able to run scripts encoded in UTF-8, provided there is a UTF-8 BOM in the script.
Since Windows 7 it is possible in Windows Command Prompt to change directory with a batch script to a directory with Unicode letters in the name. The directory name needs to be encoded in UTF-8, and the batch script must not have a BOM. The active code page of the Command Prompt needs to be set to 65001 (UTF-8) prior to the cd command. Wcd for Command Prompt will create such a go script "wcdgo.bat". It first changes the code page to 65001, then changes directory, and finally sets the code page back to the original code page. The full little ritual. π―οΈ
You need to set the font to True Type Lucida Console (not raster font) when letters don't appear correctly.
The non-Unicode Windows version of Wcd can read Unicode treedata files since version 5.2.0, provided there is a Byte Order Mark (BOM) in the file (see <http://en.wikipedia.org/wiki/Byte_order_mark>), but it can't change to directories with Unicode letters in the name that are not part of the default system ANSI code page. The Unicode Windows version of wcd writes a BOM in the UTF-8 encoded treedata files since version 5.2.0, which makes them also readable by notepad. So cute. π
π§ UTF-8 on Cygwin
Cygwin supports Unicode since version 1.7. The Cygwin layer takes care that the Windows UTF-16 Unicode names are converted to UTF-8. So programs, like wcd, don't need to be aware of this and can operate using UTF-8 encoding just like on Unix/Linux. Set character encoding to UTF-8 with the LANG or LC_CTYPE environment variable. You may need to rescan your drives. And you need to set the font to True Type Lucida Console (not raster font) if you use the default Cygwin console.
The Cygwin version behaves exactly as the Unix version of wcd. There is no BOM written in the treedata files, and it is assumed they are encoded in the Cygwin locale character encoding. Chef's kiss. π
πΎ FILES πΎ
Bestie, if the environment variable WCDHOME is set, then wcd is gonna use WCDHOME instead of HOME, periodt. Also, all those "*.wcd" files? They're literally just text files, so you can open them in any text editor and vibe with them directly. And real quick, the tea on the platform versions: the Windows Command Prompt version of wcd acts like the DOS version, and the Cygwin version of wcd acts like the Unix version. Slay, no surprises.
wcd.exeβ the program itself, the main character π. Heads up though: in Unix shells the program is always called through a function or an alias, because the current working directory of a Unix shell can only be changed by the builtincdcommand. Like, that's just the rules of the universe. See also section INSTALLATION.- default treedata file β this is the default treedata file where wcd searches for matches. If it's not readable, wcd will just create a new one, no biggie β¨
DOS: \treedata.wcd or %HOME%\treedata.wcd
Unix: $HOME/.treedata.wcd
- extra treedata file β an optional extra treedata file, if you're feeling extra (you are). If it exists and is readable, wcd will try to find matches in this file also π«Ά
DOS: \extra.wcd or %HOME%\extra.wcd
Unix: $HOME/.extra.wcd
- ban file β in this optional file wcd places banned paths. See option
-b. Wildcards are supported, so go feral π₯
DOS: \ban.wcd or %HOME%\ban.wcd
Unix: $HOME/.ban.wcd
- alias file β optional file with wcd aliases. See option
-l.
DOS: \alias.wcd or %HOME%\alias.wcd
Unix: $HOME/.alias.wcd
- stack file β in this file wcd stores its stack. The drive letter can be changed with the
-doption.
DOS: c:\stack.wcd or %HOME%\stack.wcd
Unix: $HOME/.stack.wcd
The name of the stack file can be changed with environment variable WCDSTACKFILE. See section ENVIRONMENT VARIABLES.
- go-script β this is the shell script which
wcd.execreates each time. It is sourced via a function or an alias. The drive letter can be changed with the-doption. For history reasons it is placed by default in"$HOME/bin"on Unix systems. The directory of this file can be changed with the option-G.
DOS bash: c:/wcd.go or $HOME/wcd.go
Windows Command Prompt: c:\wcdgo.bat or %HOME%\wcdgo.bat
Windows PowerShell: $env:HOME\wcdgo.ps1
WinZsh: $HOME/wcd.go
Cygwin/MSYS: $HOME/bin/wcd.go
OS/2 Command Prompt: c:\wcdgo.cmd or %HOME%\wcdgo.cmd
OS/2 bash: c:/wcd.go or $HOME/wcd.go
Unix: $HOME/bin/wcd.go
- relative treedata file β text file with relative paths from DIR. See options
+S,-nand+n.
DOS: PATH\rtdata.wcd
Unix: PATH/.rtdata.wcd
π ENVIRONMENT VARIABLES π
HOMEβ wcd uses the environment variableHOMEby default to figure out where to store its files. See also section FILES. This can be overruled with the environment variableWCDHOME.
HOME also defines where to start scanning the disk when option -s is used. This can be overruled with the environment variable WCDSCAN.
For the Unix, Cygwin, Windows PowerShell, WinZsh and MSYS version it is required that HOME or WCDHOME is set. For the other versions of wcd the use of these variables is optional.
If HOME is set on DOS/Windows, wcd will place all its files (treedata.wcd, extra.wcd, alias.wcd, ban.wcd, wcd.go) in directory HOME. The behaviour of wcd is then equal to the Unix version of wcd. Wcd will scan the disk default from HOME. Drives will not be automatically scanned by changing to them β you need to tell wcd explicitly. E.g.:
wcd -S c: -A d: -A e:
Matching of directories is now global over all scanned drives. Global matching era π
WCDHOMEβ environment variableWCDHOMEcan be used to change the location of wcd's files. If bothHOMEandWCDHOMEare set,WCDHOMEwill be used instead ofHOME.
In wcd versions prior to 5.1.5, WCDHOME also changed the default scan directory. That has changed. Since version 5.1.5, WCDHOME does not change the default scan directory. See option -s. From version 5.1.5, use environment WCDSCAN to overrule the default scan directory.
Example for DOS, Windows, OS/2 Command Prompt:
set WCDHOME=C:\Users\erwin\wcd
An example for POSIX type shells:
export WCDHOME="$HOME/.wcd"
An example for Csh type shells:
setenv WCDHOME "$HOME/.wcd"
WCDSCANβ use environment variableWCDSCANto overrule the default scan directoryHOME. Define a colon separated list (Unix) to define more than one directory. On DOS/Windows make the list semi-colon separated.
Examples for DOS, Windows, OS/2 Command Prompt:
set WCDSCAN=C:\Users\erwin;D:\data
set WCDSCAN=%HOMEDRIVE%%HOMEPATH%;\\projectdrive\projectX
An example for POSIX type shells:
export WCDSCAN="$HOME:/projectdisk/projectX"
An example for Csh type shells:
setenv WCDSCAN "$HOME:/projectdisk/projectX"
WCDFILTERβ specify filters with environment variableWCDFILTER. All directories that do not match the filter(s) are ignored. A list can be specified by separating filters by the shell path separator β similar to specifying thePATHvariable. The case sensitivity is mandated by the Operating system.
An example for DOS, Windows, OS/2 Command Prompt:
set WCDFILTER=projects;doc
An example for POSIX type shells:
export WCDFILTER="projects:doc"
An example for Csh type shells:
setenv WCDFILTER "projects:doc"
WCDBANβ the paths specified with environmentWCDBANwill be banned by wcd. See also option-b. Specify a list of paths separated by shellPATHseparator.WCDEXCLUDEβ the paths specified with environmentWCDEXCLUDEwill be excluded by wcd. See also options-xand-xf. Specify a list of paths separated by shellPATHseparator.
An example for DOS, Windows, OS/2 Command Prompt:
set WCDEXCLUDE=*/windows;*/temp;*CVS
An example for POSIX type shells:
export WCDEXCLUDE="/dev:/tmp:*CVS"
An example for Csh type shells:
setenv WCDEXCLUDE "/dev:/tmp:*CVS"
WCDUSERSHOMEβ set the base of user's home directories. On DOS/Windows the default value is"\\users". On Unix/Cygwin the default value is"/home". This variable is used to scan treedata files of other users. See also options-uand+u. In verbose mode wcd will print all filters, bans and excludes. See option-v.WCDSTACKFILEβ wcd gives preference toWCDSTACKFILEover the default stack file name (see section FILES). With this variable each shell (or used terminal emulator) can have its private stack of used directories. Obsessed with the flexibility tbh π
To use a unique time based YYYYMMDD-HHMMSS file for each opened interactive shell:
export WCDSTACKFILE=$HOME/.wcd/stack.$(date +%Y%m%d-%H%M%S)
For a stack per xterm(1), use the xterm WINDOWID environment variable:
export WCDSTACKFILE=$HOME/.wcd/stack.$WINDOWID
For GNU screen(1), to use stack per screen:
export WCDSTACKFILE=$HOME/.wcd/stack.$WINDOW
TERMINFOβ if the environment variableTERMINFOis defined, wcd with the ncurses interface checks for a local terminal definition before checking in the standard place. This is useful if terminal definitions are not in a standard place. Often used standard places are"/usr/lib/terminfo"and"/usr/share/terminfo".PDC_RESTORE_SCREENβ wcd with the PDCurses interface recognizes the environment variablePDC_RESTORE_SCREEN. If this environment variable is set, PDCurses will take a copy of the contents of the screen at the time that wcd is started; when wcd exits, the screen will be restored. An example for Windows Command Prompt:
set PDC_RESTORE_SCREEN=1
Windows allows only a small buffer to be saved. So it is not always possible to restore everything π Some garbage data may be printed in the console after wcd exits if you have set a large buffer width.
SHELLβ printing of"#!$SHELL"on the first line of the go-script for POSIX type shell or C shell is needed for 8 bit characters. Some shells otherwise think that the go-script is a binary file and will not source it. In Cygwin Bash the variableSHELLmust be set in environment using the"export"command, otherwise wcd can't read the variable.BASHβ wcd for DOS bash uses$BASHinstead of$SHELL, because$SHELLpoints to the DOS command shell. One may need to define$BASHwith an"export"command, otherwise wcd can't read the variable.
π SEE ALSO π
sh(1), bash(1), csh(1), ksh(1), zsh(1), locale(1), ncurses(1),
π AUTHORS π
Wcd was written by Erwin Waterlander <waterlan@xs4all.nl>
Project homepage: <http://waterlan.home.xs4all.nl/>
SourceForge: <http://sourceforge.net/projects/wcd/>
The manual page formatting was provided by Jari Aalto <jari.aalto@cante.net>.
NCD was originally written by Brad Kingsbury for Peter Norton's "Norton Utilities" around 1987. See also <http://www.softpanorama.org/OFM/norton_change_directory_clones.shtml>
okay bestie that's the whole page, we ate and left absolutely no crumbs πβ¨ you were reading the wcd(1) manual page, dated 2026-05-10 β go change some directories, you icon π
π
π¦ where this page comes from
- ubuntu stonking: wcd 6.0.6-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms