โ† All Linux Flashcard Decks

Linux+ Bash Scripting and Automation Flashcards

7 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Linux+ Bash Scripting and Automation flashcards as text
  1. What does the 'xargs' command primarily do in a pipeline?

    Answer: Builds and executes commands using arguments read from stdin

    xargs reads items from stdin and passes them as arguments to a specified command, enabling mass operations like xargs rm.

  2. A Bash array is declared as arr=(a b c). What does echo ${arr[@]} output?

    Answer: a b c

    ${arr[@]} expands to all elements of the array as separate words, and echo joins them with spaces.

  3. Which signal number does 'kill -9 PID' send to a process?

    Answer: SIGKILL (9)

    SIGKILL (signal 9) immediately terminates a process and cannot be caught, blocked, or ignored by the target process.

  4. What is the purpose of the 'at' command in Linux automation?

    Answer: Schedules a job to run at a specific future time once

    The at command schedules a command or script to execute once at a specified future date and time, unlike cron which is recurring.

  5. In Bash, what does 'declare -r myvar=5' do?

    Answer: Declares myvar as a read-only integer variable

    declare -r creates a read-only variable that cannot be modified or unset after declaration, similar to readonly.

  6. Which command checks the syntax of a Bash script without executing it?

    Answer: bash -n script.sh

    bash -n reads the script and checks for syntax errors without executing any commands, useful for pre-validation.

  7. What does the 'tee' command do when used in a pipeline?

    Answer: Reads stdin and writes it to both stdout and a file simultaneously

    tee reads from stdin and writes identical output to both stdout (for further piping) and one or more files at the same time.