Input/Output Redirection Flashcards

1
Q

How do you use output redirection to append to a file?

A

> >

i.e ls&raquo_space; file

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

How do you use output redirection to overwrite a file?

A

>

i.e ls > file

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

How do you use output redirection to redirect only stdout?

A

1>

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

How do you use output redirection to redirect only stderr?

A

2>

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

How do you use input redirection to redirect to a command?

A

<

i.e head < file

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

How do you use output redirection to redirect stderr and stdout?

A

&>

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

How do you redirect stderr to stdout?

A

2>&1

*useful if piping as they only accept stdout

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

How does piping work?

A

Allows to take stdout and provide it to another command

i.e cat file | wc

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

What location can be redirected to if the output is not needed?

A

/dev/null

*empty character device containing nothing

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