103.4 Use streams, pipes and redirects Flashcards

1
Q

What does the command xargs do?

A

It will take the stdout of one command and use it as stdin in another command as options, just like -exec but it is more efficient.

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

What does the command xargs do?

A

It will take the stdout of one command and use it as stdin in another command as options, just like -exec but it is more efficient.

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

What does the tee command do?

A

It redirects stdout from one command to a file while at the same time printing the stdout to the screen to be seen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
What does this command do?
#ls -d /usr/share/doc/lib[Xx]* | tee lib.docs.txt
A
  • It lists only directories within /usr/share/doc/lib
  • The directories to be listed start with a capital or lowercase X
  • The stdout gets written to the file lib.docs.txt while being printed on the screen.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What symbol do you use to redirect stdout as stdin to a command?

A

pipe |

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

How do you redirect stdin towards a command?

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

What symbols do you use to append stdout to a file?

A

> >

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

What does the tee command do?

A

It redirects stdout from one command to a file while at the same time printing the stdout to the screen to be seen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
What does this command do?
#ls -d /usr/share/doc/lib[Xx]* | tee lib.docs.txt
A
  • It lists only directories within /usr/share/doc/lib
  • The directories to be listed start with a capital or lowercase X
  • The stdout gets written to the file lib.docs.txt while being printed on the screen.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What symbol do you use to redirect stdout as stdin to a command?

A

pipe |

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

Give an example of standard output and standard input.

A
#wc test.sh   
# wc < test.sh
cat /etc/passwd | less
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What symbols do you use to append stdout to a file?

A

> >

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

How do you redirect stdout and stdin of a script to the less command?

A

test.script 2>&1 | less

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

Which are the file handles for stdout, stdin and stderr?

A

stdin < 0
stdout > 1
stderr : 2

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

Where is stderr printed?

A

It is printed to the screen just like stdout

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

How is standard error abbreviated?

A

Stderr

17
Q

Give an example of standard output and standard input.

A
#wc test.sh   
# wc < test.sh
18
Q

How is standard input abbreviated as?

stdin

A

What are the symbols used for stdin?

< and pipe ( | )

19
Q

Where does standard input come from?

A

It comes from the user’s input on the keyboard.

Also sodut of a command can be the stdin or another.

20
Q

What are the symbols used to redirect stdout?

A

> and&raquo_space;

21
Q

What is stdout?

A

It is whatever you see printed on the screen when you run a command.

22
Q

How is standard output abbreviated?

A

stdout

23
Q

How can you retrieve the process IDs that are related to a particular user?

A

psgrep -u