15.7. Terminal Control Commands

Command affecting the console or terminal


Initialize terminal and/or fetch information about it from terminfo data. Various options permit certain terminal operations. tput clear is the equivalent of clear, below. tput reset is the equivalent of reset, below. tput sgr0 also resets the terminal, but without clearing the screen.

 bash$ tput longname
 xterm terminal emulator (XFree86 4.0 Window System)

Issuing a tput cup X Y moves the cursor to the (X,Y) coordinates in the current terminal. A clear to erase the terminal screen would normally precede this.

Note that stty offers a more powerful command set for controlling a terminal.


This command prints out extensive information about the current terminal. It references the terminfo database.

 bash$ infocmp
 #       Reconstructed via infocmp from file:
 rxvt|rxvt terminal emulator (X Window System), 
         am, bce, eo, km, mir, msgr, xenl, xon, 
         colors#8, cols#80, it#8, lines#24, pairs#64, 
         bel=^G, blink=\E[5m, bold=\E[1m,
         clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, 


Reset terminal parameters and clear text screen. As with clear, the cursor and prompt reappear in the upper lefthand corner of the terminal.


The clear command simply clears the text screen at the console or in an xterm. The prompt and cursor reappear at the upper lefthand corner of the screen or xterm window. This command may be used either at the command line or in a script. See Example 10-25.


This utility records (saves to a file) all the user keystrokes at the command line in a console or an xterm window. This, in effect, creates a record of a session.

    Place for this material granted by linux and technology portal www.net4me.ru