Forrest logo
back to the expand tool

expand:tldr:31407

expand: Convert tabs to spaces, reading from standard input.
$ expand
try on your machine

The command "expand" is used in various operating systems and software programs to convert tabs in a file into spaces or to shrink consecutive spaces into tabs.

In some cases, "expand" is used to convert tabs into a defined number of spaces. For example, if a text file contains tabs that are set to be equal to 4 spaces, the command "expand -t4 filename.txt" will replace all tabs with 4 spaces each.

Conversely, "expand" can also be used to convert a specified number of spaces into tabs. For instance, if a text file contains 4 consecutive spaces, the command "expand -t4 filename.txt" will replace those spaces with a single tab character.

The "expand" command is particularly useful when working with files that are required to have a specific spacing or when maintaining consistent formatting across different platforms or programs.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the expand tool