utfout(1) utility for producing UTF-8 output to standard streams and terminal.


utfout [OPTION]... [STRING]...


Echo strings to specified output stream(s).


-a, --intra-char=<char> Insert specified character (which may be a 1-character escape character) between all output characters.
-b, --intra-pause=<delay>
Pause between writing each character.
-e, --stderr
Write subsequent strings to standard error (file descriptor 2).
-h, --help
This help text.
-i, --interpret
Interpret escape characters (default).
-l, --literal
Write literal strings only (disable escape characters).
-o, --stdout
Write subsequent strings to standard output (file descriptor 1).
-p, --prefix=<prefix>
Use <prefix> as escape prefix (default='\').
-r, --repeat=<repeat>
Repeat previous value <repeat> times.
-s, --sleep=<delay>
Sleep for <delay> amount of time.
-t, --terminal
Write subsequent strings directly to terminal.
-u, --file-descriptor=<fd>
Write to specified file descriptor.
-x, --exit=<num>
Exit with value <num>.


utfout recognises C-style escape sequences as used by printf(1) . By default an escape sequence is introduced by the backslash character ('\'), however this may be changed with the -p option. utfout also supports some additional sequences:
- nul byte (hex value 0x00)
- alert (bell)
- backspace
- no further output
- escape character (used for changing terminal attributes)
- form feed
- generate pseudo-random printable character
- newline
- byte with octal value NNN (1 to 3 digits)
- carriage return
- horizontal tab
- 2 byte Unicode (ISO/IEC 10646) character with hex value NNNN (4 digits)
- 4 byte Unicode (ISO/IEC 10646) character with hex value NNNNNNNN (8 digits)
- vertical tab
- byte with hexadecimal value NN (1 to 2 digits)


utfout also supports range escapes which allow a range of characters to be specified in a compact format.
- specify a range by two 1-byte literal characters.
- specify a range by two 3-byte octal values.
- specify a range by two 2-byte Unicode values.
- specify a range by two 4-byte Unicode values.
- specify a range by two 2-byte hex values.

Note that ranges take two values of the same type and the maximum width for that type must be specified.


  • Arguments are processed in order.
  • With the exception of '-x', arguments may be repeated any number of times.
  • All output will be sent to standard output until an output redirection option is specified that changes the output stream (namely -e or -t (or their long-option equivalents), or if output has already been redirected -o (or its long-option equivalent)).
  • If <str> is the empty string ("" or '') it will be treated as \0 such that a nul byte will be displayed.
  • To cancel the effect of -a, specify a null string: -a ''.
  • If <repeat> is '-1', repeat forever.
  • Replace the 'Z' in the range formats above with the appropriate characters.
  • Ranges can be either ascending or descending.
  • <delay> can take the following forms where <num> is a positive integer:

  • <num>ns : nano-seconds (1/1,000,000,000 second)
    <num>us : micro-seconds (1/1,000,000 second)
    <num>ms : milli-seconds (1/1,000 second)
    <num>cs : centi-seconds (1/100 second)
    <num>ds : deci-seconds (1/10 second)
    <num>s  : seconds
    <num>m  : minutes
    <num>h  : hours
    <num>h  : days
    <num>   : seconds
    If <num> is -1, wait until any signal is received.
    If signal is SIGNUM continue, else exit immediately.
  • Generated printable random characters may not display unless you are using an appropriate font.


 # Print "foofoofoo" to stderr, followed by "barbar" to stdout.
 utfout "foo" -r 2 -o "bar" -r 1
 # Write 50 nul bytes direct to the terminal.
 utfout -t "" -r 49
 # Write continuous stream of nul bytes direct to the terminal,
 # 1 per second.
 utfout -b 1s -t '' -r -1
 # Display a greeting slowly (as a human might type)
 utfout -b 20cs "Hello, $USER.\n"
 # Display a "spinner" that loops 4 times.
 utfout -b 20cs -p % "%r|%r/%r-%r\%r" -r 3
 # Display all digits between zero and nine with a trailing
 # newline.
 utfout "\{0..9}\n"
 # Display slowly the lower-case letters of the alphabet,
 # backwards without a newline.
 utfout -b 1ds "\{z..a}"
 # Display upper-case 'ABC' with newline.
 utfout '\u0041\u0042\u0043\n'
 # Display 'foo' with newline.
 utfout '\o146\u006f\x6F\n'
 # Clear the screen.
 utfout '\n' -r $LINES
 # Write hello to stdout, stderr and the terminal.
 utfout 'hello' -t -r 1 -e -r 1
 # Display upper-case letters of the alphabet using octal
 # notation, plus a newline.
 utfout "\{\o101..\o132}"
 # Display 'h.e.l.l.o.' followed by a newline.
 utfout -a . "hello" -a '' "\n"
 # Display upper-case and lower-case letters of the alphabet
 # including the characters in-between, with a trailing newline.
 utfout "\{A..z}\n"
 # Display lower-case alphabet followed by reversed lower-case alphabet
 # with the digits zero to nine, then nine to zero on the next line.
 utfout "\{a..z}\{z..a}\n\{0..9}\{9..0}\n"
 # Display lower-case Greek letters of the alphabet.
 utfout "\{α..ω}"
 # Display cyrillic characters.
 utfout "\{Ѐ..ӿ}"
 # Display all printable ASCII characters using hex range:
 utfout "\{\x21..\x7e}"
 # Display all printable ASCII characters using 2-byte UTF-8 range:
 utfout "\{\u0021..\u007e}"
 # Display all printable ASCII characters using 4-byte UTF-8 range:
 utfout "\{\U00000021..\U0000007e}"
 # Display all braille characters.
 utfout "\{\u2800..\u28FF}"
 # Display 'WARNING' in white on red background.
 utfout '\e[37;41mWARNING\e[0m\n'
 # Generate 10 random characters.
 utfout '\g' -r 9


Written by James Hunt <[email protected]>


Copyright © 2012 James Hunt <[email protected]>


GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.