CSI 3336 Final

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

1/65

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

66 Terms

1
New cards

When matching filenames in the shell, the ____________________ symbol will match any single character.

?

2
New cards

When matching filenames using regular expressions, the ____________________ symbol will match any single character.

.

3
New cards

In shell, executables can be called without supplying an absolute path or a relative path because of the _____________ environment variable.

$PATH

4
New cards

What is stored in the $HOME environment variable

the path to the user's home dir

5
New cards

how do I cd into the home directory?

cd ~

6
New cards

How do I cd into the root directory?

cd /

7
New cards

The environment variable _________________ stores the exit status of the most recently run executable.

$?

8
New cards

What environment variable do I use to get the PID of a shell program?

$$

9
New cards

What environment variable do I use to get the number of variables of a shell program?

$#

10
New cards

Which type of quoting suppresses expansion of variables?

single quotes

11
New cards

What type of quotes are used for command substitution?

back ticks ``

12
New cards

/usr/bin is a directory on our systems that contain ____________

are available to a normal user

13
New cards

What will this command do to the permissions of an executable +rx?

adds read and execute permissions to all user groups

14
New cards

What are the different user groups for a program?

owner, group, others

15
New cards

What will this command do to the permissions of an executable 777?

adds read, write and execute permissions to all user groups

16
New cards

What mode will set permissions for the owner and group to just read and execute, and restrict others to just read?

554

17
New cards

In a shell script, the ________________ line specifies the executable that should interpret the script.

Shabang, #!

18
New cards

What is the environment variable for the name of a bash script?

$0

19
New cards

What is the meaning of true in bash?

0

20
New cards

The _____ is a special directory used to resolve relative paths to the current working directory, while _____ is a special directory used to resolve relative paths to the previous directory.

./ and ../

21
New cards

Write a shell expansion that matches all files in the local directory that begin with "cs".

cd*

22
New cards

Write a shell expansion that matches all files that are located in smithb's home directory ending in ".sh".

~/smithb/*.sh

23
New cards

Write a regular expression that matches lines containing "catinthehat.txt".

catinthehat\.txt

24
New cards

Write a shell expansion that matches all files that are named "file" followed by any single character followed by ".txt".

file?.txt

25
New cards

Write a regular expression that matches lines that start with "proj4" and end with ".c".

^proj4.*\.c$

26
New cards

Write a shell expansion that matches all files ending in ".thm".

*.thm

27
New cards

The Linux ps command give you information about ______________________________.

currently running processes

28
New cards

In shell, the special character _________________ can be used to redirect standard output from the command that precedes it to standard input of the command that follows it.

|, pipe

29
New cards

In shell, special characters like < and > can be used to ________________________ standard input and output streams.

redirect

30
New cards

What key combination will save a copy of the current file without exiting while in control mode?

w

31
New cards

What key combination will delete the current line while in control mode?

dd

32
New cards

What are the shell commands to get the current date, current working directory and the user ID?

date

pwd

id -u

33
New cards

what is the function to open a file for system calls?

int fd = open(path, O_RDONLY);

34
New cards

What is the function to read from a file using system calls?

ssize_t read(int fd, void *buf, size_t count);

35
New cards

What is the function to write to a file using system calls?

ssize_t write(int fd, const void *buf, size_t count);

36
New cards

What is the function to open a file using stdio?

FILE fopen(const char path, const char *mode);

37
New cards

What is the read mode for opening a file using stdio?

"r"

38
New cards

What is the function to close a file using stdio?

fclose

39
New cards

What function should I use if I want to get to a certain spot in a file and start reading/writing to there? (head, tail)

fseek

40
New cards

What function should I use if I want to interpret flags from running a program?

getopt

41
New cards

How do I specify that there is an argument with the flag with getopt?

Put a colon before the flag, for example :x means that there is an argument after the flag. Use optarg to get the argument

42
New cards

What is the function to get the exit status of a child?

WEXITSTATUS

43
New cards

What is the function to check if a child process is finished given the PID?

waitpid(pid, status, 0);

WIFEXITED(&status)

44
New cards

What is the function to create a thread?

int pthread_create(pthread_t , const pthread_abr_t , void ()(void ), void );

45
New cards

What is the function to initialize a semaphore?

sem_init(&semaphore)

46
New cards

what does semwait do?

it will check if semaphore is unlocked...if not it will wait until it is opened (lock)

47
New cards

what does sem_post do?

it increments the value in the semaphore struct...basically showing that its done with executing (open)

48
New cards

Threads have a ______ memory/system model?

shared

49
New cards

What is a race condition?

A race condition is when multiple threads access a shared resource and one of them increments it but the other thread doesn't realize

50
New cards

What number is the write side of a pipe?

fd[1]

51
New cards

What number is the read side of a pipe?

fd[0]

52
New cards

sh shell name?

Bourne Shell

53
New cards

csh

C shell

54
New cards

What is a directory I could write output to and not care?

/dev/null

55
New cards

Use $(( )) for simple arithmetic and let for unary operations. (T/F)

true

56
New cards

Zombie process

A child process that is waiting to return its exit status to its parent (defunct)

57
New cards

Developers of UNIX

Denis Ritchie, Ken Thompson, Brian Kernighan

58
New cards

Regex that matches any 5 letter sequence that repeats at least once

grep -E "([a-zA-Z]{5}).*\1" file_name

59
New cards

Vim move cursor to beginning of file

gg

60
New cards

Vim: get editor to move cursor to end of current line

$

61
New cards

Vim: undo last change to file

u

62
New cards

Developer of Linux

Linus Torvalds

63
New cards

Anchor to beginning for regex

^

64
New cards

Anchor to end for regex

$

65
New cards

What is the syntax for a makefile recipe?

MUST have a tab

66
New cards

____ is a system call that can be used to determine if a string corresponds to a file or a directory.

stat