Scroll to navigation

UNEXPAND(1) General Commands Manual UNEXPAND(1)

NAME

unexpand - Convert blanks in each FILE to tabs, writing to standard output. With no FILE, or when FILE is -, read standard input.

SYNOPSIS

unexpand [-a|--all] [-f|--first-only] [-t|--tabs] [-U|--no-utf8] [-h|--help] [-V|--version] [file]

DESCRIPTION

Convert blanks in each FILE to tabs, writing to standard output. With no FILE, or when FILE is -, read standard input.

OPTIONS

convert all blanks, instead of just initial blanks
convert only leading sequences of blanks (overrides -a)
use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)
interpret input file as 8-bit ASCII rather than UTF-8
Print help
Print version

VERSION

v(uutils coreutils) 0.9.0

EXAMPLES

Convert blanks in each file to tabs, writing to `stdout`:

unexpand path/to/file

Convert blanks to tabs, reading from `stdout`:

unexpand

Convert all blanks, instead of just initial blanks:

unexpand [-a|--all] path/to/file

Convert only leading sequences of blanks (overrides -a):

unexpand --first-only path/to/file

Have tabs a certain number of characters apart, not 8 (enables -a):

unexpand [-t|--tabs] number path/to/file

The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail.

2026-06-04