commands

expand — convert tabs to spaces

Convert tabs to spaces using tab stops; -t N uses stops every N columns, -i limits conversion to initial tabs. Other bytes remain as text output. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
expand [OPTION]... [FILE]...

Parameters & Attributes

NameTypeDescription
-toptionTab stop spacing
-ioptionInitial tabs only
FILEoperandInput file

Return Value

exit status and output

GNU expand writes text with tabs converted to spaces according to selected tab stops and returns nonzero on errors. Successful output may be identical if no applicable tabs exist.

Working Example

Example Snippetlinux
expand -t 4 tabs.txt
Linux Reference