CNIT 340 Exam 2

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards

How to start docker containers?

docker run

2
New cards

How to pull docker images?

docker pull

3
New cards

How to list docker images?

docker image/images

4
New cards

How to list running docker images?

docker ps

5
New cards

What does stdin do?

Where input to the application is sourced?

6
New cards

What does stdout do?

Where output from the application sent

7
New cards

What does stderr do?

Where error messages are sent

8
New cards

What file descriptor represent stdin?

0

9
New cards

What file descriptor represents stdout?

1

10
New cards

What file descriptor represents stderr?

2

11
New cards

How to redirect stdout?

>

12
New cards

How to redirect stdin?

<

13
New cards

How to redirect stderr?

2>

14
New cards

Does >> overwrite the destination filename?

No

15
New cards

What does 2>&1 do?

Redirects stderr to the same destination as stdout

16
New cards

How to silence all output?

/dev/null 2>&1

17
New cards

A script needs to be _____ before it can be run

Executable

18
New cards

How to make a script executable?

chmod +x

19
New cards

What does the first line of a script indicate?

What shell to use for the script

20
New cards

What is the first line of the script?

#!/path/to/bash

21
New cards

What three files does BASH parse for the login shell?

~/.bash_profile, ~/.bash_login, ~/.profile

22
New cards

What file does BASH use when a login shell is exited?

~/.bash_logout

23
New cards

What file does BASH parse for a non-login interactive shell?

~/.bashrc

24
New cards

Does BASH parse any files when a scripting shell is being used?

No

25
New cards

What command do you use to filter unwanted output?

grep -v

26
New cards

What type of file is a shell script?

Text file

27
New cards

What can a scalar variable do?

Hold one element/value at a time

28
New cards

What can an array variable do?

Hold multiple elements/values at a time

29
New cards

What is a global variable?

A variable that can be accessed or modified from any part of the script

30
New cards

What is a local variable?

A variable that can only be used in the function where it is defined

31
New cards

How do you declare a local variable with the name cat?

local cat

32
New cards

Can a global variable and local variable have the same name?

Yes

33
New cards

What command do you use to send a variable to a subshell?

export

34
New cards

Can you export a variable to its parent shell?

No

35
New cards

User defined variables can start with a number (T/F)?

F

36
New cards

What is best practice for naming user defined variables?

Put user defined variables in ALL CAPS

37
New cards

How do you define scalar variables?

name=value

38
New cards

How do you define the variable named cat and the value of “black cat”?

cat=“black cat”

39
New cards

What sign do you need to use for substitution?

$

40
New cards

How do you define the variable named cat and the value of black cat (no space required)

cat=black+cat