tabs
Set terminal tab stops
SYNOPSIS
tabs [options] [tabstop-list]
tabstop-list can be a comma-separated list of column numbers (e.g., `1,5,10,20`), an interval notation (e.g., `-n+m`), or a predefined type (e.g., `-8`, `-c`, `-u`).
PARAMETERS
tabstop-list
A comma-separated list of explicit column numbers (e.g., `1,5,10,20`), or an interval definition (`-n+m` meaning every `n` columns starting at `m+1`).
-8
Default tabs. Sets tab stops at every 8 columns (1, 9, 17, ...).
-a, -aN
Assembler tabs. Sets tabs for assembler code (1, 10, 16, 36, 72). With `N`, the fourth stop is `N`.
-c
C-style tabs. Sets tabs for C code (1, 9, 17, 25, ...).
-e
EBCDIC tabs. Sets tabs for EBCDIC code (1, 7, 15, 19, 43, 80).
-f
Fortran tabs. Sets tabs for Fortran code (1, 7, 11, 15, 19, 23, ...).
-p
PL/I tabs. Sets tabs for PL/I code (1, 5, 9, 13, 17, 21, ...).
-s
SNOBOL tabs. Sets tabs for SNOBOL code (1, 10, 55).
-t
TABEX tabs. Sets tabs for TABEX code (1, 8, 12, 16, 20, 24, ...).
-u
UNIX tabs. Sets tabs for UNIX code (1, 9, 17, 25, ...).
+mN
Margin offset. Used with certain predefined types (e.g., `-a`) to add a left margin of `N` columns before applying tab stops.
-d, --debug
Debugging output. Prints debugging information to standard error.
-n, --newlines
Newline control. Ensures a newline is printed after each tab setting command.
-T TERM, --term=TERM
Specify terminal type. Overrides the `TERM` environment variable for tab calculations.
-V, --version
Version information. Displays the program's version number and exits.
DESCRIPTION
The `tabs` command is a curses program designed to configure hardware tab stops on a terminal. Unlike software tabs (handled by applications like text editors), hardware tabs are managed directly by the terminal emulator or physical terminal using specific escape sequences defined in the terminfo database. When a tab character is sent, the cursor jumps directly to the next hardware tab stop.
This utility provides various methods to specify tab stops, including common predefined patterns (e.g., default every 8 columns, C-style, or Fortran-style) and custom lists of column positions. While less critical on modern graphical terminal emulators (which often just expand tabs to spaces), hardware tabs can still be useful for performance or consistent behavior in specific environments, especially on older systems or serial consoles where every character transmission is significant. It overwrites any previously set hardware tab stops.
CAVEATS
Not all terminal emulators or physical terminals fully support hardware tab stop settings; many modern ones simply interpret tabs as spaces.
The `tabs` command overwrites any previously configured hardware tab stops. Be aware that settings are specific to the current terminal session.
Incorrect terminfo entries for your terminal type can lead to `tabs` not functioning as expected or not at all.
HARDWARE VS. SOFTWARE TABS
Hardware tabs are settings stored and managed by the terminal itself. When a tab character is received, the terminal's internal logic moves the cursor directly to the next predefined tab stop using specific escape sequences. This is distinct from software tabs, where applications (like text editors) interpret a tab character and then send multiple space characters or other sequences to achieve the desired indentation. Hardware tabs are generally faster as they involve less data transmission but offer less flexibility than software tabs managed by applications.
TAB SPECIFICATION METHODS
`tabs` provides several ways to define tab stops.
Predefined Types: Options like `-8` (every 8 columns), `-c` (C-style), `-f` (Fortran-style), etc., set common patterns.
Explicit List: A comma-separated list of column numbers (e.g., `1,10,25,50`) defines exact tab stop positions.
Interval Notation: The format `-n+m` sets tab stops every `n` columns, with the first stop at column `m+1`.
HISTORY
The `tabs` command is an integral part of the ncurses project, a widely used library providing a free software implementation of the System V Release 4.0 curses API. Its purpose has consistently been to manage terminal hardware tab stops, leveraging the comprehensive terminfo database to send the correct escape sequences to various terminal types.
While the prevalence of physical terminals has waned, and modern terminal emulators often handle tabs through software (e.g., inserting spaces), `tabs` persists as a utility. It ensures compatibility with legacy systems and offers a way to configure low-level terminal behavior where hardware-level control is desired or beneficial, such as on serial consoles or in highly optimized environments. Its development has mirrored that of the ncurses library, adapting to evolving terminal standards while maintaining its core functionality.