unix exam 2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/64

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.

65 Terms

1
New cards

$VAR

Used to access the contents of a previously assigned name

2
New cards

VAR=value

Syntax for assigning information to a reusable name

3
New cards

$(command)

A method to run a command and return its result inside a script

4
New cards

`command`

An older syntax for inserting the output of a command

5
New cards

-e

Checks if something exists at a specified path

6
New cards

-f

Checks if something is a regular file

7
New cards

-d

Checks if something is a directory

8
New cards

-eq

Compares two numbers for equality

9
New cards

-ne

Checks if two numeric values are different

10
New cards

-gt

Used when comparing if one number is higher than another

11
New cards

-lt

Used when checking if one number is smaller than another

12
New cards

[ condition ]

Syntax used to evaluate a true or false expression

13
New cards

if [ condition ]; then ... fi

A way to control whether code runs based on a check

14
New cards

for var in list; do ... done

Used to repeat commands for each item in a group

15
New cards

while [ condition ]; do ... done

Repeats code as long as a test is true

16
New cards

echo

Displays text or values to the screen

17
New cards

read VAR

Takes input from the user and stores it in a named location

18
New cards

exit

Stops execution of the current script

19
New cards

fi

Indicates the conclusion of a decision structure

20
New cards

done

Marks the end of a repetition structure

21
New cards

#!/bin/bash

Placed at the top to specify which interpreter should run the file

22
New cards

Makefile

A script-like file that tells a build tool how to construct a program

23
New cards

make

A utility that reads instructions to build software components

24
New cards

Target (in Makefile)

The result that a build rule aims to produce

25
New cards

Dependency (in Makefile)

A required item that must be present or up-to-date to proceed

26
New cards

Rule (in Makefile)

A set of steps used to transform inputs into outputs during a build

27
New cards

gcc -c

Creates an intermediate compiled file but does not produce a runnable output

28
New cards

gcc -o

Used to define the name of the file that will be generated

29
New cards

Linking

Combines multiple compiled pieces into a single runnable program

30
New cards

Object File (.o)

An intermediate result from compiling code, not yet ready to run

31
New cards

Executable

The final product of the build process, capable of being launched directly

32
New cards

clean target

A command often used to remove generated files and reset the environment

33
New cards

-lm

Adds an extra resource commonly used for calculations during program building

34
New cards

Variables in Makefile

Custom placeholders used to simplify repetition in build scripts

35
New cards

gcc -Wall

Enables warnings to help spot possible mistakes in source code

36
New cards

getopts

Used to handle options provided when launching a script

37
New cards

trap

Allows a script to react to unexpected interruptions

38
New cards

exec

Replaces the current running task with a new one without returning

39
New cards

make clean

A quick way to delete everything produced during the build process

40
New cards

fork()

Creates a new process by duplicating the calling process

41
New cards

exec()

Replaces the current process image with a new program

42
New cards

wait()

Makes the parent process pause until a child finishes

43
New cards

waitpid()

Waits for a specific child process to finish

44
New cards

_exit()

Terminates a process immediately without flushing stdio buffers

45
New cards

getpid()

Returns the ID of the calling process

46
New cards

getppid()

Returns the ID of the parent process of the calling process

47
New cards

zombie process

A terminated child process that hasn't been waited on by the parent

48
New cards

orphan process

A child process whose parent has terminated

49
New cards

signal

A notification sent to a process to notify it of events like interrupts

50
New cards

kill()

Sends a signal to a process, often to terminate it

51
New cards

WIFEXITED

Macro that checks if a child terminated normally

52
New cards

WEXITSTATUS

Macro that retrieves the exit status of a terminated child

53
New cards

&

Runs a command in the background

54
New cards

fg

Resumes a background job in the foreground

55
New cards

bg

Resumes a stopped job in the background

56
New cards

jobs

Lists background and suspended jobs for the current shell

57
New cards

kill

Stops a process by sending it a signal

58
New cards

nice

Alters the priority of a process

59
New cards

nohup

Runs a command immune to hangups and logs output

60
New cards

ps

Displays currently running processes

61
New cards

top

Shows real-time system processes and resource usage

62
New cards

sleep

Pauses execution for a set time

63
New cards

%1

Refers to job number 1 in job control

64
New cards

%+

Refers to the current job

65
New cards

%-

Refers to the previous job