tabs - Linux


The tabs command in Linux is used to set tab stops on the terminal. This utility allows users to configure the positions where the tab character (\t) will stop, which is especially useful for formatting output in terminal sessions or scripts. The command can be employed in various environments like shell scripting, text formatting, and code display to ensure that the data appears aligned according to the set tab stops.


The basic syntax of the tabs command is as follows:

tabs [option] [+mN]

Where option can be a list of tab stop positions or preset option. +mN sets the margin (optional).


Here are the common options/flags for the tabs command:

  • -n: Sets tab stops every n columns.
  • -T type: Specifies a terminal type for setting tabs.
  • +mN: Set left margin at column N (defaults to 0 if this option is not used).
  • --version: Display version information and exit.
  • --help: Show help message and exit.

Presets are also part of the options and include:

  • -a: Use the assembly language format.
  • -c: Configure tabs for COBOL (crunched).
  • -f: Set tabs suitable for FORTRAN code.
  • -p: Setup for PL/I format.
  • -s: Define settings for SNOBOL code.
  • -u: Configure for UNIVAC 1100 Assembler.


  1. Set tab stops every 8 spaces:

    tabs 8
  2. Custom tab stops at columns 3, 10, and 20:

    tabs 3,10,20
  3. Set tab stops suited for COBOL with a left margin at column 5:

    tabs -c +m5

Common Issues

  • Tabs Not Visible: Ensure your terminal or text editor interprets and displays tabs as expected. Some IDEs or editors may convert tabs into spaces automatically.

  • Inconsistent formatting across environments: If your script will run in various environments, verify the default tab width in each, as it can vary.

Solution: Use additional display commands like cat -T to visualize tabs, or set up environment-specific configuration files.


tabs can integrate seamlessly with text-processing commands. For instance, to format a list where columns neatly align, you could use:

tabs 20,40; cat mylist.txt | expand

This will set tab stops at specific positions before expanding the tabs in the file mylist.txt so that columns align perfectly.

  • expand – Converts tabs to spaces.
  • unexpand – Converts spaces to tabs based on specified tab stops.
  • setterm – Used to set terminal attributes, which can complement the settings from tabs.

For further reading and more detailed information, consult the tabs manual page through the command man tabs, which will provide additional insights and specifics related to your system’s implementation of the command.