Previous | Table of Contents | Next |
DESCRIPTION
The external tabs command is used to set the tab stops on your terminal. The BSD version of tabs is limited compared to the System V version. You can use the tabs command to reset the tab stops on your terminal. The tabs program allows you to reset the tab stops using four different formats. These formats are:
Other options allow you to:
NOTE:
Your terminal must support remote setting of hardware tab stops for tabs to work correctly.
COMMAND FORMAT
Following is the general format of the tabs command.
tabs [ tabspec ] [ -Tterminal_type ] [ +mn ]
|
|
BSD (Berkeley) | |
---|---|
tabs [ -n ] [ terminal_type ] | |
|
Options
The following list describes the options and their arguments that may be used to control how tabs functions. The first set of options are different formats used to set tab stops.
Tabspec These options define different formats used to set tab stops on your terminal. This set of options is divided into four groups.
Arbitrary Settings
Use arbitrary numbers to set tab stops where you desire.
n1,n2,n3,... | Set tab stops in columns n1, n2, n3, and so on. All numbers must be separated by a comma. If you priced a number with + (plus sign) the number will be used as an increment added to the last tab stop number. Thus the two formats: | |
tabs 4,10,12,18,26 | ||
tabs 4,+6,+2,+6,+8 | ||
are equivalent. |
Canned Settings
Use one of the following codes to select a canned set of tab stops. Canned settings are predefined tab positions.
-a | Set tab stops at columns 1, 10, 16, 36, and 72. Used for IBM S/370 Assembler coding format, first format. |
-a2 | Set tab stops at columns 1, 10, 16, 40, and 72. Used for IBM S/370 Assembler coding format, second format. |
-c | Set tab stops at columns 1, 8, 12, 16, 20, and 55. Used for normal COBOL format. |
-c2 | Set tab stops at columns 1, 6, 10, 14, and 49. Used for compact COBOL format. Columns 1-6 are omitted, thus the first character begins in columns 7. |
-c3 | Set tab stops at columns 1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, and 67. Used for compact COBOL format. Columns 1-6 are omitted. These are the recommended tab stops for COBOL. |
-f | Set tab stops at columns 1, 7, 11, 15, 19, and 23. Used for FORTRAN coding format. |
-p | Set tab stops at columns 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, and 61. Used for PL/I coding format. |
-s | Set tab stops at columns 1, 10, and 55. Used for SNOBOL coding format. |
-u | Set tab stops at columns 1, 12, 20, and 44. Used for UNIVAC 1100 Assembler coding format. |
Repetitive Settings
This sets tab stops every n columns. This is how the normal tab stops are set.
-n | Set tab stops every n columns. The first tab stop is at 1+n. The second stop is at 1+(n*2), the third is at 1+(n*3), and so on. The UNIX system "standard" is based on a repetition of 8. This places stops at 9, 17, 25, etc. The value of 0 may be used to specify no tab stops. |
Setting stored in Files
Tab stops may be defined and stored in a file that can later be used to guarantee tab settings are correct before a file is displayed.
- file | The first line of the file must contain a format specification as described in section 4 of the UNIX Programmers Reference Manual. |
Other Options The following are the remaining options used with the tabs command.
-Tterminal_type | Specify the terminal_type. tabs usually needs to know the type of terminal to send the correct tab setting sequence to the terminal. The terminal type must be known to send margin settings. Terminal_type is valid terminal type stored in the terminfo (or /etc/termcap) database. |
If -T is not specified, tabs uses the value of your environment variable TERM. If TERM is not defined, tabs sends a generic sequence to set the tabs that works for multiple terminal types. | |
+mn | Set left margin on the terminal. The terminal type must be known by tabs for the margin to be set. Setting the margin causes the left side of the text display to move over to column 1+n. If no n is provided, tabs assumes a number of 10 and the left margin is set to column 11. To reset your margin to normal, the leftmost setting, use a value of 0 for n. The GE TermiNet terminal must have the left margin specified as 1. |
|
|
BSD (Berkeley) | |
---|---|
-n | The left margin of the terminal is not indented. |
|
Arguments
The following list describes the arguments that may be passed to the tabs command.
|
|
BSD (Berkeley) | |
---|---|
terminal_type | The name of a terminal type. The terminal type must be a valid terminal found in the /etc/termcap file. |
If no terminal_type is provided, a default setting is used. This is a fairly standard setting and works for many of the older "dumb" terminals. |
FURTHER DISCUSSION
When you press the Tab key on your terminal a tab character (Ctrl-I) is sent to the terminal and on to UNIX. The terminal moves the cursor to the next "tab stop" set on your terminal. The normal setting for tab stops is every eighth column. This equates to columns 9, 17, 25, 33, 41, and so on. By using tabs you can reset these tab stops to new column positions.
You can also set margins on terminals that support margin control. By default, tabs uses the value of the TERM variable. For proper functioning of tabs you should define the TERM variable or use the -T option. The -T option overrides the TERM value.
DIAGNOSTICS AND BUGS
Some terminals may interpret the first tab setting as a margin setting. Others may not clear tabs as requested. The tabs command can only clear up to 20 tab stops but can set up to 64.
The following messages may be returned by tabs if a problem is incurred:
illegal tabs | Arbitrary tabs are not in the correct order. |
illegal increment | Arbitrary tab numbers contain a 0 or missing increment number. |
unknown tab code | A code used for a canned tab setting does not exist. |
can't open | A file cannot be opened. If you used the-file option, then file does not exist. |
file indirection | The file referred to by-file contains a reference to yet another file. |
RELATED COMMANDS
Refer to the stty and tput commands described in modules 126 and 139.
It may be necessary to read fspec and terminfo entries in section 4 of your UNIX Programmers Reference Manuals to fully understand how tabs works.
RELATED FILES
The tabs command writes to the standard output to send its character sequences to your terminal to set the tab stops and margins.
APPLICATIONS
The primary use of the tabs command is to provide a formatted screen using tabs. This makes output more readable. It is especially useful for programming languages. You can set your tab stops to every four spaces on the screen, but when you print the listing you can have pr expanding your tabs to every 8 spaces. Thus you can compact your code on-line (on your screen) and expand it to a more readable format on the printout.
TYPICAL OPERATION
In this activity you use the tabs command to reset your terminal's tab stops to every fourth column. Begin at the shell prompt.
Previous | Table of Contents | Next |