Debian Codegraph @

HTML/terminalccmds.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Terminal Control Commands</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="Advanced Bash-Scripting Guide"
12 HREF="index.html"><LINK
13 REL="UP"
14 TITLE="External Filters, Programs and Commands"
15 HREF="external.html"><LINK
16 REL="PREVIOUS"
17 TITLE="Communications Commands"
18 HREF="communications.html"><LINK
19 REL="NEXT"
20 TITLE="Math Commands"
21 HREF="mathc.html"><META
22 HTTP-EQUIV="Content-Style-Type"
23 CONTENT="text/css"><LINK
24 REL="stylesheet"
25 HREF="common/kde-common.css"
26 TYPE="text/css"><META
27 HTTP-EQUIV="Content-Type"
28 CONTENT="text/html; charset=iso-8859-1"><META
29 HTTP-EQUIV="Content-Language"
30 CONTENT="en"><LINK
31 REL="stylesheet"
32 HREF="common/kde-localised.css"
33 TYPE="text/css"
34 TITLE="KDE-English"><LINK
35 REL="stylesheet"
36 HREF="common/kde-default.css"
37 TYPE="text/css"
38 TITLE="KDE-Default"></HEAD
39 ><BODY
40 CLASS="SECT1"
41 BGCOLOR="#FFFFFF"
42 TEXT="#000000"
43 LINK="#AA0000"
44 VLINK="#AA0055"
45 ALINK="#AA0000"
46 STYLE="font-family: sans-serif;"
47 ><DIV
48 CLASS="NAVHEADER"
49 ><TABLE
50 SUMMARY="Header navigation table"
51 WIDTH="100%"
52 BORDER="0"
53 CELLPADDING="0"
54 CELLSPACING="0"
55 ><TR
56 ><TH
57 COLSPAN="3"
58 ALIGN="center"
59 >Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting</TH
60 ></TR
61 ><TR
62 ><TD
63 WIDTH="10%"
64 ALIGN="left"
65 VALIGN="bottom"
66 ><A
67 HREF="communications.html"
68 ACCESSKEY="P"
69 >Prev</A
70 ></TD
71 ><TD
72 WIDTH="80%"
73 ALIGN="center"
74 VALIGN="bottom"
75 >Chapter 16. External Filters, Programs and Commands</TD
76 ><TD
77 WIDTH="10%"
78 ALIGN="right"
79 VALIGN="bottom"
80 ><A
81 HREF="mathc.html"
82 ACCESSKEY="N"
83 >Next</A
84 ></TD
85 ></TR
86 ></TABLE
87 ><HR
88 ALIGN="LEFT"
89 WIDTH="100%"></DIV
90 ><DIV
91 CLASS="SECT1"
92 ><H1
93 CLASS="SECT1"
94 ><A
95 NAME="TERMINALCCMDS"
96 ></A
97 >16.7. Terminal Control Commands</H1
98 ><DIV
99 CLASS="VARIABLELIST"
100 ><P
101 ><B
102 ><A
103 NAME="TERMCOMMANDLISTING1"
104 ></A
105 >Command affecting the console
106 or terminal</B
107 ></P
108 ><DL
109 ><DT
110 ><A
111 NAME="TPUTREF"
112 ></A
113 ><B
114 CLASS="COMMAND"
115 >tput</B
116 ></DT
117 ><DD
118 ><P
119 >Initialize terminal and/or fetch information about it from
120 <SPAN
121 CLASS="DATABASE"
122 >terminfo</SPAN
123 > data. Various options permit
124 certain terminal operations: <B
125 CLASS="COMMAND"
126 >tput clear</B
127 >
128 is the equivalent of <A
129 HREF="terminalccmds.html#CLEARREF"
130 >clear</A
131 >;
132 <B
133 CLASS="COMMAND"
134 >tput reset</B
135 > is the equivalent
136 of <A
137 HREF="terminalccmds.html#RESETREF"
138 >reset</A
139 >.</P
140 ><P
141 > <TABLE
142 BORDER="0"
143 BGCOLOR="#E0E0E0"
144 WIDTH="90%"
145 ><TR
146 ><TD
147 ><PRE
148 CLASS="SCREEN"
149 > <TT
150 CLASS="PROMPT"
151 >bash$ </TT
152 ><TT
153 CLASS="USERINPUT"
154 ><B
155 >tput longname</B
156 ></TT
157 >
158 <TT
159 CLASS="COMPUTEROUTPUT"
160 >xterm terminal emulator (X Window System)</TT
161 >
162 </PRE
163 ></TD
164 ></TR
165 ></TABLE
166 >
167 </P
168 ><P
169 >Issuing a <B
170 CLASS="COMMAND"
171 >tput cup X Y</B
172 > moves
173 the cursor to the (X,Y) coordinates in the current
174 terminal. A <B
175 CLASS="COMMAND"
176 >clear</B
177 > to erase the terminal
178 screen would normally precede this.</P
179 ><P
180 >&#13; Some interesting options to <I
181 CLASS="FIRSTTERM"
182 >tput</I
183 > are:
184
185 <UL
186 ><LI
187 ><P
188 ><TT
189 CLASS="OPTION"
190 >bold</TT
191 >, for high-intensity
192 text</P
193 ></LI
194 ><LI
195 ><P
196 ><TT
197 CLASS="OPTION"
198 >smul</TT
199 >, to underline text
200 in the terminal</P
201 ></LI
202 ><LI
203 ><P
204 ><TT
205 CLASS="OPTION"
206 >smso</TT
207 >, to render text in
208 reverse</P
209 ></LI
210 ><LI
211 ><P
212 ><TT
213 CLASS="OPTION"
214 >sgr0</TT
215 >, to reset the terminal
216 parameters (to normal), without clearing the
217 screen</P
218 ></LI
219 ></UL
220 >
221
222 </P
223 ><P
224 >Example scripts using <I
225 CLASS="FIRSTTERM"
226 >tput</I
227 >:
228 <OL
229 TYPE="1"
230 ><LI
231 ><P
232 ><A
233 HREF="colorizing.html#COLORECHO"
234 >Example 36-15</A
235 ></P
236 ></LI
237 ><LI
238 ><P
239 ><A
240 HREF="colorizing.html#EX30A"
241 >Example 36-13</A
242 ></P
243 ></LI
244 ><LI
245 ><P
246 ><A
247 HREF="contributed-scripts.html#HOMEWORK"
248 >Example A-44</A
249 ></P
250 ></LI
251 ><LI
252 ><P
253 ><A
254 HREF="contributed-scripts.html#NIM"
255 >Example A-42</A
256 ></P
257 ></LI
258 ><LI
259 ><P
260 ><A
261 HREF="arrays.html#POEM"
262 >Example 27-2</A
263 ></P
264 ></LI
265 ></OL
266 >
267 </P
268 ><P
269 >Note that <A
270 HREF="system.html#STTYREF"
271 >stty</A
272 > offers
273 a more powerful command set for controlling a terminal.</P
274 ></DD
275 ><DT
276 ><A
277 NAME="INFOCMPREF"
278 ></A
279 ><B
280 CLASS="COMMAND"
281 >infocmp</B
282 ></DT
283 ><DD
284 ><P
285 >This command prints out extensive information about the
286 current terminal. It references the
287 <I
288 CLASS="FIRSTTERM"
289 >terminfo</I
290 > database.</P
291 ><P
292 > <TABLE
293 BORDER="0"
294 BGCOLOR="#E0E0E0"
295 WIDTH="90%"
296 ><TR
297 ><TD
298 ><PRE
299 CLASS="SCREEN"
300 > <TT
301 CLASS="PROMPT"
302 >bash$ </TT
303 ><TT
304 CLASS="USERINPUT"
305 ><B
306 >infocmp</B
307 ></TT
308 >
309 <TT
310 CLASS="COMPUTEROUTPUT"
311 ># Reconstructed via infocmp from file:
312 /usr/share/terminfo/r/rxvt
313 rxvt|rxvt terminal emulator (X Window System),
314 am, bce, eo, km, mir, msgr, xenl, xon,
315 colors#8, cols#80, it#8, lines#24, pairs#64,
316 acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
317 bel=^G, blink=\E[5m, bold=\E[1m,
318 civis=\E[?25l,
319 clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M,
320 ...</TT
321 >
322 </PRE
323 ></TD
324 ></TR
325 ></TABLE
326 >
327 </P
328 ></DD
329 ><DT
330 ><A
331 NAME="RESETREF"
332 ></A
333 ><B
334 CLASS="COMMAND"
335 >reset</B
336 ></DT
337 ><DD
338 ><P
339 >Reset terminal parameters and clear text screen. As with
340 <B
341 CLASS="COMMAND"
342 >clear</B
343 >, the cursor and prompt reappear in the
344 upper lefthand corner of the terminal.</P
345 ></DD
346 ><DT
347 ><A
348 NAME="CLEARREF"
349 ></A
350 ><B
351 CLASS="COMMAND"
352 >clear</B
353 ></DT
354 ><DD
355 ><P
356 >The <B
357 CLASS="COMMAND"
358 >clear</B
359 > command simply clears
360 the text screen at the console or in an
361 <I
362 CLASS="FIRSTTERM"
363 >xterm</I
364 >. The prompt and cursor
365 reappear at the upper lefthand corner of the screen or
366 xterm window. This command may be used either at the command
367 line or in a script. See <A
368 HREF="testbranch.html#EX30"
369 >Example 11-26</A
370 >.</P
371 ></DD
372 ><DT
373 ><A
374 NAME="RESIZEREF"
375 ></A
376 ><B
377 CLASS="COMMAND"
378 >resize</B
379 ></DT
380 ><DD
381 ><P
382 >Echoes commands necessary to set <TT
383 CLASS="VARNAME"
384 >$TERM</TT
385 >
386 and <TT
387 CLASS="VARNAME"
388 >$TERMCAP</TT
389 > to duplicate the
390 <I
391 CLASS="FIRSTTERM"
392 >size</I
393 > (dimensions) of the current
394 terminal.</P
395 ><P
396 > <TABLE
397 BORDER="0"
398 BGCOLOR="#E0E0E0"
399 WIDTH="90%"
400 ><TR
401 ><TD
402 ><PRE
403 CLASS="SCREEN"
404 > <TT
405 CLASS="PROMPT"
406 >bash$ </TT
407 ><TT
408 CLASS="USERINPUT"
409 ><B
410 >resize</B
411 ></TT
412 >
413 <TT
414 CLASS="COMPUTEROUTPUT"
415 >set noglob;
416 setenv COLUMNS '80';
417 setenv LINES '24';
418 unset noglob;</TT
419 >
420 </PRE
421 ></TD
422 ></TR
423 ></TABLE
424 >
425 </P
426 ></DD
427 ><DT
428 ><A
429 NAME="SCRIPTREF"
430 ></A
431 ><B
432 CLASS="COMMAND"
433 >script</B
434 ></DT
435 ><DD
436 ><P
437 >This utility records (saves to a file) all the user keystrokes at
438 the command-line in a console or an xterm window. This, in effect,
439 creates a record of a session.</P
440 ></DD
441 ></DL
442 ></DIV
443 ></DIV
444 ><DIV
445 CLASS="NAVFOOTER"
446 ><HR
447 ALIGN="LEFT"
448 WIDTH="100%"><TABLE
449 SUMMARY="Footer navigation table"
450 WIDTH="100%"
451 BORDER="0"
452 CELLPADDING="0"
453 CELLSPACING="0"
454 ><TR
455 ><TD
456 WIDTH="33%"
457 ALIGN="left"
458 VALIGN="top"
459 ><A
460 HREF="communications.html"
461 ACCESSKEY="P"
462 >Prev</A
463 ></TD
464 ><TD
465 WIDTH="34%"
466 ALIGN="center"
467 VALIGN="top"
468 ><A
469 HREF="index.html"
470 ACCESSKEY="H"
471 >Home</A
472 ></TD
473 ><TD
474 WIDTH="33%"
475 ALIGN="right"
476 VALIGN="top"
477 ><A
478 HREF="mathc.html"
479 ACCESSKEY="N"
480 >Next</A
481 ></TD
482 ></TR
483 ><TR
484 ><TD
485 WIDTH="33%"
486 ALIGN="left"
487 VALIGN="top"
488 >Communications Commands</TD
489 ><TD
490 WIDTH="34%"
491 ALIGN="center"
492 VALIGN="top"
493 ><A
494 HREF="external.html"
495 ACCESSKEY="U"
496 >Up</A
497 ></TD
498 ><TD
499 WIDTH="33%"
500 ALIGN="right"
501 VALIGN="top"
502 >Math Commands</TD
503 ></TR
504 ></TABLE
505 ></DIV
506 ></BODY
507 ></HTML
508 >