CompTIA Linux+ XK0-005 Scripting & Automation Flashcards
CompTIA Linux+ XK0-005 (v7) Flashcards

| Front | Back |
| How can you check if a variable is empty in Bash | Use '[ -z "$variable" ]' |
| How do you capture the output of a command in a variable in Bash | Use backticks (`command`) or $(command) |
| How do you create a variable in Bash | variable_name=value |
| How do you list all scheduled cron jobs for the current user | crontab -l |
| How do you make a script executable | Use 'chmod +x <script_name>' |
| How do you redirect stderr to a file in Bash | Use '2>' followed by the file name |
| How do you remove a cron job for the current user | Use 'crontab -r' |
| How do you test for equality between two numbers in Bash | Use '[ value1 -eq value2 ]' |
| What command is used to debug a Bash script line-by-line | bash -x <script_name> |
| What does 'source' or '.' do in Bash | It executes a script in the current shell environment |
| What does $0 represent in a Bash script | It represents the name of the script being executed |
| What does the 'read' command do in Bash scripting | It reads user input and assigns it to a variable |
| What does the $? variable represent in Bash | It holds the exit status of the last executed command |
| What is cron syntax format | minute hour day month day_of_week command |
| What is the default shell environment variable that holds the user's path | PATH |
| What is the function of the 'export' command | To make an environment variable available to child processes |
| What is the purpose of 'set -e' in a Bash script | It exits the script if any command fails |
| What is the purpose of a shebang (#!) at the beginning of a script | It specifies the interpreter to execute the script. |
| What is the purpose of the 'trap' command in Bash scripting | To catch signals and execute commands when they occur |
| What operator is used to append output to a file | >> |
| What tool provides a simplified method for creating scheduled jobs in a human-readable format | Anacron |
| What variable is used to store the number of arguments passed to a script | $# |
| Which command is used to schedule a one-time task | at |
| Which command is used to schedule tasks on Linux | cron or at |
About the Flashcards
Flashcards for the CompTIA Linux+ exam help you review core Bash scripting terminology, commands, and behaviors commonly tested. The deck emphasizes quick recall of script execution, permissions, environment variables, debugging, and task scheduling so you can answer command- and concept-based questions efficiently.
Cards cover shebangs and making scripts executable (chmod +x), variable and parameter handling ($#, $0, export), command substitution and capturing output, redirection and appending (>>, 2>), signal handling with trap, input with read and sourcing scripts, debugging tools (bash -x, set -e, $?) and cron/at/anacron scheduling including crontab commands and cron syntax.
Topics covered in this flashcard deck:
- Shebang and execution
- Script permissions (chmod)
- Variables and parameters
- Command substitution
- Redirection and stderr
- Cron, at, anacron