Week 5 - The UNIX Shell Flashcards

1
Q

What is a shell?

A

a program that runs operating system commands

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

What happens when you open the shell?

A

a user-level process is started

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

How does the shell create a child process?

A

by calling fork

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

what does the child process invoke?

A

the loader, via execve

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

What 3 open files does each process begin with?

A

standard input, output and error

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

STDIN_FILENO = ?

A

0

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

STDOUT_FILENO = ?

A

1

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

STDERR_FILENO = ?

A

2

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

Whats the chmod command format?

A

chmod [who] operator [permissions] filename

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

how do you check the value of a single variable?

A

echo $VARNAME

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

how do you set the value of a variable?

A

export VARNAME=x

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

what does * mean in pattern matching?

A

matches any string (including null)

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

what does ? mean in pattern matching?

A

matches any one character

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

what does […] mean in pattern matching?

A

matches any characters enclosed in the brackets

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

what does [!…] mean in pattern matching?

A

matches any characters other than the ones in the brackets

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

what is the format for a grep command?

A

grep “[a,b]” input.txt

17
Q

what is a shell script?

A

a file holding a program built with shell commands

18
Q

what is $#?

A

the n umber of parameters passed to the script

19
Q

what is $0?

A

the script name

20
Q

what is $1?

A

first parameter

21
Q

what is $2?

A

second parameter

22
Q

what is $@?

A

all parameters

23
Q

what is $? ?

A

the exit value of the last command