Redirection Flashcards

(14 cards)

1
Q

1️⃣ Q: What can you use the shell to do with stdout and stderr?

A

A: Redirect them from the terminal screen to a file on the filesystem.

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

2️⃣ Q: What is used to redirect output to a file in the shell?

A

A: The > shell metacharacter followed by the absolute or relative pathname of the file.

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

3️⃣ Q: How do you redirect only stdout to a file called goodoutput?

A

A: Append the number of the file descriptor (1) followed by the redirection symbol > and the file name goodoutput.

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

What can be assume form the results from the following command

[root@server1 ~]#  ls /etc/hosts /etc/h  1>goodoutput

ls: cannot access ‘/etc/h’: No such file or directory

[root@server1 ~]#_

A

the stderr displayed on the terminal screen because it was not redirected to a file while the /etc/hosts was due to it being redicited to a file called goodoutput

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

what number is do you appended for stout?

A

1

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

what number is do you appended for sterr

A

2

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

true or false the shell assumes stdout by default if no numerb is given for rediection?

A

True

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

1️⃣ Q: Does the order of redirection on the command line matter in Linux?

A

no

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

what happens if you used differing filenames to hold the contents of stdout and stderr?

A

what happens is a loss of data due to writing to both at once

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

how do redirect both stdout and sdterr to the same file without anyloss assuming there are two files you are lsing?

A

> goodoutput 2>&1

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

how do you remove errors from common output in order to discard them>?

A

edirect the stderr to /dev/null

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

how do you prevent a file from being cleared by the shell when redicecting?

A

do the double redicited infount IE&raquo_space;

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

1️⃣ Q: What is a limitation of some commands regarding file input?

A

A: Some commands only accept files that the shell passes through stdin.

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

3️⃣ Q: What can the tr command be used for?

A

A: To replace characters in a file sent via stdin.

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