Input Redirection Flashcards

(12 cards)

1
Q

Types of Input Redirection

A

■ Standard Input (stdin)

	■ Basic Input Redirection <

	■ Here-document Redirection <<

	■ Here-string Redirection <<<
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Standard Input (stdin)

A

■ Standard input is the default way a program receives input

	■ Standard input usually comes from the keyboard
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The cat command without redirection __________

A

waits for additional input

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

What is CTRL-D is used for?

A

signal the end-of-file (EOF) through stdin

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

Basic Input Redirection <

A

< operator is used to redirect input from a file

r feeds pre-written data into a command automatically

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

cat < myfile.txt

A

displays the contents of myfile.txt

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

mail -s “I Love Linux” support@diontraining.com < message.txt

A

uses message.txt as the body of an email

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

Here-document Redirection «

A

known as a here-document

■ Allows embedding multi-line input directly in a command

■ Requires a delimiter to mark the start and end of the text block

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

«_space;Example

A

cat «EOF

		This is the first line.

		This is the second line.

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

Here-string Redirection «<

A

known as a here-string

Allows passing a single string as input to a command

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

Example

A

mysql -u admin -p «< “DROP DATABASE IF EXISTS testdb; CREATE DATABASE testdb; USE testdb; SOURCE /path/to/setup.sql;”

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