vis comes in the box, and it is used.

Way back in 1983, Rob Pike and Brian W. Kernighan wrote a critique of what the BSD people at CSRG had done to AT&T Unix tools, titled The UNIX system: Program design in the UNIX environment. One of the things critiqued was how the BSD people had added options to the cat command, which was supposed to just concatenate two or more files. They opined that instead of cat having a -v option (a shibboleth for a certain brand of Unix nostalgia that this is the origin of) a separate program named vis was how people should encode non‐graphic characters so that they do not mess up output devices that might understand them as control characters. They claimed to have written one, but there's no sign that they really had; there's no such program in Plan9, for instance.

Ironically, over 40 years later, the BSDs that came in for such criticism of how terrible they are, are the one place where one can get a vis command. (Debian thinks that it's the name of a text editor.) It was written by Marc Teitelbaum in 1990, the same year that Teitelbaum made the BSD ps command use getopt.

Pike and Kernighan also opined that cat -n should be replaced by a linenumber command. Neither they nor Teitelbaum wrote that one. I wrote what as far as I've been able to tell is the first linenumber command, in 2026. I wrote that for completeness, having just written a sqz command as the Pike&Kernighan‐like replacement for cat -s.

Teitelbaum's vis was originally based around a C library function named cdecode. Xe renamed cdecode to its current name of vis the following month.

The library has grown somewhat, and is used by various parts of the BSDs nowadays.

One of the critiques of cat -v that Pike and Kernighan missed was that there was no decoding utility. Teitelbaum wrote an unvis as well.

It is interesting to note that to this day a decoding utility for cat -v does not exist. Indeed, one cannot exist. The output of vis contains more backslashes than cat -v on the same input, you may notice. This is because the output of vis is reliably decodable back to the original input, precisely because the backslashes distinguish various otherwise ambiguous encoded forms. cat -v to this day, having never been fixed anywhere (BSD versions, GNU Core Utilities, or even the supposedly rewritten from scratch uutils), produces ambiguous output that cannot be reliably translated back to the original input.

I really mean to this day. The day that I wrote this page, I made a patch to fix GNU Core Utilities.


© Copyright 2026 Jonathan de Boyne Pollard. "Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp is preserved.