UNEXPAND(1) User Commands UNEXPAND(1)

# [NAME](#NAME)

unexpand - convert spaces to tabs

# [SYNOPSIS](#SYNOPSIS)

**unexpand** \[*OPTION*]... \[*FILE*]...

# [DESCRIPTION](#DESCRIPTION)

Convert blanks in each FILE to tabs, writing to standard output.

With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.

[**-a, --all**](#a,)

convert all blanks, instead of just initial blanks

[**--first-only**](#first)

convert only leading sequences of blanks (overrides **-a**)

[**-t, --tabs=N**](#t,)

have tabs N characters apart instead of 8 (enables **-a**)

[**-t, --tabs=LIST**](#t,~2)

use comma separated list of tab positions. The last specified position can be prefixed with '/' to specify a tab size to use after the last explicitly specified tab stop. Also a prefix of '+' can be used to align remaining tab stops relative to the last specified tab stop instead of the first column

[**--help**](#help)

display this help and exit

[**--version**](#version)

output version information and exit

# [AUTHOR](#AUTHOR)

Written by David MacKenzie.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to: &lt;bug-coreutils@gnu.org&gt;.  
Report any translation bugs to: &lt;https://translationproject.org/team/&gt;.  
GNU coreutils home page: &lt;https://www.gnu.org/software/coreutils/&gt;  
General help using GNU software: &lt;https://www.gnu.org/gethelp/&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;https://gnu.org/licenses/gpl.html&gt;.  
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

# [SEE ALSO](#SEE_ALSO)

[**expand**(1)](/man/os/coreutils/expand.1)

Full documentation &lt;https://www.gnu.org/software/coreutils/unexpand&gt;  
or available locally via: info '(coreutils) unexpand invocation'

October 2026 GNU coreutils 9.12

---

Document: unexpand(1) from coreutils 9.12-r7 (Chainguard OS)
Source: https://git.savannah.gnu.org/git/coreutils.git
