Text Processing

expand

Convert tabs in input to spaces.

Synopsis

syntax
expand [OPTION]... [FILE]...

Examples

Convert tabs to spaces (8-column)
expand file.txt
Convert tabs to 4-space indentation
expand -t 4 file.txt
Only convert leading tabs (preserve inline)
expand -i file.txt

Common options

FlagDescription
-tSet tab stops (default 8)
-iOnly convert leading tabs

About expand

The `expand` command convert tabs in input to spaces. Text processing commands transform, format, and generate text output.

Linux's philosophy of small composable tools shines here — these commands are designed to be piped together to build complex text-processing workflows. They are indispensable for scripting, log analysis, and data transformation tasks.

The command accepts 2 commonly used flags shown above, though the full set of options is available in the man page (`man expand`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Text Processing Commands

Other commands in the Text Processing category

Related tools