Redir/pipes Flashcards

1
Q

STDIN

A

Standard input
0

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

What will this do?
~~~
python hello.py < foo.txt
~~~

A

feed foo.txt to stdin for python

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

STDOUT

A

Standard Out
1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
python hello.py > output.txt
A

stdout to (file)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
python hello.py >> output.txt
A

stdout to (file), append

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

STDERR

A

Standard Error
2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
python hello.py 2> error.log
A

stderr to (file)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
python hello.py 2>&1
A

stderr to stdout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
python hello.py 2>/dev/null
A

stderr to (null)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
python hello.py >output.txt 2>&1
A

stdout and stderr to (file), equivalent to &>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
python hello.py &>/dev/null
A

stdout and stderr to (null)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
echo "$0: warning: too many users" >&2
A

print diagnostic message to stderr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
diff <(ls -r) <(ls)
A

Compare two stdout without files

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