Managing Terminals Flashcards

1
Q

Bash shell, and terminal it runs on, are ______ ________ used by experianced Linux users.

A

primary tools.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When terminals display info, they usually display…?

A

one byte at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When computers are handling human readable text, the characters are usually…?

A

Encoded as an integer byte value using the ASCII format. (One byte can encode up to 256 different values, only a small number of these (about 100) are used for text characters and punctuation. The others are used to encode control sequence and other special conditions.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The _____ command can restore a terminal to sane behavior.

A

reset. (Usually, when you’d like to use the command, you won’t even be able to see yourself type it. However, if at an unreadable bash prompt, blindly typing reset and followed by the RETURN key will usually restore the terminal to sane behavior.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Linux terminals share a lot in common with their primitive ancestors, teletypes and “dumb” or vt100-like consoles. These early devices had mechanisms for sending “out of band” signals, or sequences that signaled some event outside of the normal flow of type characters, such as a backspace, a linefeed, an audible bell, or an end of transmission. Linux terminals, like their predecessors, use the _____ key to send these “out of band” signals.

A

CTRL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CTRL+C (SIGNT)

A

Abnormal Interrupt - terminate the foreground process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

CTRL+D (EOT)

A

Normal signaling of the end of input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CTRL+G (BEL)

A

Sound an audible terminal bell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CTRL+H (BS)

A

Backspace - erase the previous character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CTRL+J (LF)

A

Line feed - alternative for the RETURN key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

CTRL+L (FF)

A

Form feed - causes bash to clear screen, and other screen based programs to “refresh” the current screen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

CTRL+Q

A

Thaw the terminal display (see CTRL+S)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

CTRL+S

A

Freeze the terminal display (thaw with CTRL+Q)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

CTRL+U (NAK)

A

Erase current line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

CTRL+Z (SIGSTOP)

A

Suspend the foreground process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

CTRL+C is probably the most useful of the above sequences, coming to the rescue whenever a user is felling “JUST MAKE IT STOP!” When using the bash shell, typing CTRL+C will….?

A

Terminate the currently running process, and return you to the bash prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The /dev/zero device node is a pseudo device that, when read…?

A

returns an infinite number of (binary) zeros.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The /dev/null device node is a pseudo device that throws away any…?

A

information written to it.

19
Q

/dev/zero > /dev/null would…?

A

run forever, reading zeros and throwing them away. (Someone stuck in this situation could use CTRL+C to cancel the command)

20
Q

CTRL+D is used to send…?

A

an “End of Transmission” (usually interpreted as “End of File”) to the listening process.

21
Q

The wc command is an example of a command that, when not given a filename as an argument, will count the number of lines, words, and characters that a user types in from the keyboard. The user signals the end of the input with…?

A

CTRL+D

22
Q

When using the wc command what would happen if we used CTRL+C…?

A

The wc command would have been canceled, not reporting any output.

23
Q

CTRL+Z is used to…?

A

Suspend a program, (Which can later be restored with the fg (“forground”) command.

24
Q

While in the middle of an ftp session, how do you view the current working directory..?

A

Suspend the ftp session with CTRL+Z, run the pwd command from the shell, then restore the ftp session using fg.

25
Q

CTRL+U is commonly used to…?

A

“Wipe” the current line. (So if you have a mangled bash command line that you just want to start over, type CTRL+U. Also, CTRL+U is very helpful when you mess up entering a password. Because your characters are usually not echoed bach to you, its often hard to know what you’ve type. Just type CTRL+U and start over.)

26
Q

CTRL+H serves the same role as …?

A

BACKSPACE key. (On some terminals however, BACKSPACE key is incorrectly mapped, and doesn’t function correctly. CTRL+H will almost always work in these situations.)

27
Q

CTRL+L was traditionally used to tell a line printer to eject…?

A

the current page and start on the next one.

28
Q

CTRL+L for online terminals, has been re purposed for…?

A

redrawing screens.

29
Q

When using a screen based program, including the vi and nano editors, if the screen ever becomes mangled because of unexpected messages, CTRL+L will cause the program…?

A

to refresh the screen, redrawing it correctly.

30
Q

For bash shell, CTRL+L causes…?

A

bash to clear the screen, but preserve the current command line.

31
Q

CTRL+G, the only real use is to…?

A

make the terminal beep, impressing your friends with your vast reservoirs of Unix knowledge.

32
Q

Processes are grouped into…?

A

“sessions” based on which terminal they were started from. (While somewhat outdated, knowing how to recognize terminals can help in tracking the origins of processes.)

33
Q

Programs interact with terminals at…?

A

a low level through device nodes, found within the /dev directory. (For example, communication with the first virtual console uses the devices node /dev/tty1. Most processes keep a record of which terminal they were started from, and user’s login sessions are usually associated with the terminal they are using. When identifying terminals in these situations, the terminal is referred to by its device node, for example, tty1)

34
Q

Many different devices are treated by Linux as a terminal, including…?

A

Virtual consoles, serial line connected VT100 terminals, modems, etc.

35
Q

ttyn (Virtual Console)

A

Accessed with the CTRL+ALT+Fn key combination.

36
Q

ttySn (Serial port device)

A

A modem or VT100 like terminal attached to a serial port. The terminal ttyS0 in Unix relates to COM1 in DOS, ttyS1 to COM2, and so on.

37
Q

pts/n (Pseudo-terminal)

A

A terminal emulation, most often used by terminal windows in the X graphical environment, or shells which originate over the network, such as with the telnet or ssh. Pseudo-terminals cannot be related directly to a physical device.

38
Q

:0 (X server)

A

The X server environment is not really a terminal. When a user logs in using the X graphical environment, their terminal may be listed as the X server itself.

39
Q

When typing the names of commands and files, a lot of time and effort can be saved by learning how to make good use of the …?

A

TAB key

40
Q

When typing the name of a command as the first word of a bash command line, start typing the command you would like to run, but at some point before you finish the word, stop and hit the TAB key. One of three things will happen….

A
  • The rest of the command you were beginning to type magically appears.
  • Part of the command you were typing magically appears, but then bash stops and beeps at you.
  • bash just beeps at you.
41
Q

The bash shell does the best job that it can in selecting the command you were starting to type from…?

A

the list of all possible commands.

42
Q

If when pushing the Tab key, the rest of the command magically appears, the bash was able to…?

A

figure out exactly what command you were starting, and finished it for you.

43
Q

When after pushing tab, part of the command you were typing magically appears, but then bash stops and beeps at you…?

A

more than one command started out with the letters you were typing. bash completed the command as far as possible, but stopped with a beep to let you know that you still have some choices to make. In order to see the selection of commands that bash has narrowed it down to, hit the TAB key a second time. bash will list all commands that start with what you have typed. Supply enough of the remainder of the command to make it unique, and hit TAB again. bash will finish the command for you.

44
Q

When you push tab, bash just beeps at you…?

A

more than one command started out with the letters you were typing. bash completed the command as far as possible, but stopped with a beep to let you know that you still have some choices to make. In order to see the selection of commands that bash has narrowed it down to, hit the TAB key a second time. bash will list all commands that start with what you have typed. Supply enough of the remainder of the command to make it unique, and hit TAB again. bash will finish the command for you.