Random oneliners

From diffies' wiki
Revision as of 03:29, 16 October 2026 by Foxture (talk | contribs)
Jump to navigationJump to search

Here I place some useful/interesting/silly oneliners – mostly in GNU bash and Perl.

List characters used in a file tree

This produces a neatly formatted listing of special characters in a given directory tree. (Note the slash, which is the path separator.)

find directory/ | fold -w1 | sort | uniq | fmt

Example output:

_ - @ / = 0 1 2 3 4 5 6 7 8 9 a A b B c C d D e E f F g G h H i j J l
L m n N o p P q r R s S t u U v w x y Y

Note that this breaks for whitespace (ASCII space is rendered as a blank line at the beginning of the output) and control characters, not to mention Unicode.

Processing of a big filesystem trees can take a considerable time, as this dumb oneliner sorts the letters before deduplicating them.