1/64
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
$VAR
Used to access the contents of a previously assigned name
VAR=value
Syntax for assigning information to a reusable name
$(command)
A method to run a command and return its result inside a script
`command`
An older syntax for inserting the output of a command
-e
Checks if something exists at a specified path
-f
Checks if something is a regular file
-d
Checks if something is a directory
-eq
Compares two numbers for equality
-ne
Checks if two numeric values are different
-gt
Used when comparing if one number is higher than another
-lt
Used when checking if one number is smaller than another
[ condition ]
Syntax used to evaluate a true or false expression
if [ condition ]; then ... fi
A way to control whether code runs based on a check
for var in list; do ... done
Used to repeat commands for each item in a group
while [ condition ]; do ... done
Repeats code as long as a test is true
echo
Displays text or values to the screen
read VAR
Takes input from the user and stores it in a named location
exit
Stops execution of the current script
fi
Indicates the conclusion of a decision structure
done
Marks the end of a repetition structure
#!/bin/bash
Placed at the top to specify which interpreter should run the file
Makefile
A script-like file that tells a build tool how to construct a program
make
A utility that reads instructions to build software components
Target (in Makefile)
The result that a build rule aims to produce
Dependency (in Makefile)
A required item that must be present or up-to-date to proceed
Rule (in Makefile)
A set of steps used to transform inputs into outputs during a build
gcc -c
Creates an intermediate compiled file but does not produce a runnable output
gcc -o
Used to define the name of the file that will be generated
Linking
Combines multiple compiled pieces into a single runnable program
Object File (.o)
An intermediate result from compiling code, not yet ready to run
Executable
The final product of the build process, capable of being launched directly
clean target
A command often used to remove generated files and reset the environment
-lm
Adds an extra resource commonly used for calculations during program building
Variables in Makefile
Custom placeholders used to simplify repetition in build scripts
gcc -Wall
Enables warnings to help spot possible mistakes in source code
getopts
Used to handle options provided when launching a script
trap
Allows a script to react to unexpected interruptions
exec
Replaces the current running task with a new one without returning
make clean
A quick way to delete everything produced during the build process
fork()
Creates a new process by duplicating the calling process
exec()
Replaces the current process image with a new program
wait()
Makes the parent process pause until a child finishes
waitpid()
Waits for a specific child process to finish
_exit()
Terminates a process immediately without flushing stdio buffers
getpid()
Returns the ID of the calling process
getppid()
Returns the ID of the parent process of the calling process
zombie process
A terminated child process that hasn't been waited on by the parent
orphan process
A child process whose parent has terminated
signal
A notification sent to a process to notify it of events like interrupts
kill()
Sends a signal to a process, often to terminate it
WIFEXITED
Macro that checks if a child terminated normally
WEXITSTATUS
Macro that retrieves the exit status of a terminated child
&
Runs a command in the background
fg
Resumes a background job in the foreground
bg
Resumes a stopped job in the background
jobs
Lists background and suspended jobs for the current shell
kill
Stops a process by sending it a signal
nice
Alters the priority of a process
nohup
Runs a command immune to hangups and logs output
ps
Displays currently running processes
top
Shows real-time system processes and resource usage
sleep
Pauses execution for a set time
%1
Refers to job number 1 in job control
%+
Refers to the current job
%-
Refers to the previous job