Curated

System Management

0 votes

Questions206

  1. Question 201

    System Management

    An administrator is working with aliases in an interactive bash shell. Which statements about aliases are correct? (Choose four.)

    Choose 4 answers

    Show the answer

    Correct answersA. Running unalias -a removes all aliases defined in the current shell.B. Running alias ll prints the current definition of the alias ll.C. Running alias with no arguments lists every alias defined in the current shell.D. A value that contains spaces must be quoted, as in alias ll='ls -l'.

    alias alone lists all aliases, alias name shows one definition, unalias -a clears them all, and quotes are needed when the value contains spaces. Spaces around the equals sign break the definition, because bash treats each word as a separate argument. Non-interactive scripts do not expand interactive aliases.

    Open this question
  2. Question 202

    System Management

    An administrator needs a list of the account names in /etc/passwd whose login shell is /bin/bash. The file is colon-delimited, with the username in field 1 and the shell in field 7, and the output must contain only the usernames. Which command produces this output?

    Show the answer

    Correct answerA. awk -F: '$7 == "/bin/bash" {print $1}' /etc/passwd

    awk -F: sets the colon as the field separator, so the test on field 7 selects the bash users and print $1 outputs only their names. Without -F:, awk splits on whitespace, so $7 is empty and nothing matches. The cut and grep pipeline would also print the shell, not just the names.

    Open this question
  3. Question 203

    System Management

    Earlier in a bash session an administrator ran rsync -av /data /backup, followed by several unrelated commands. The administrator now wants to repeat the most recent command that began with rsync without retyping it. Which entry does this?

    Show the answer

    Correct answerA. !rsync

    !string re-executes the most recent history entry that starts with that string, so !rsync reruns the earlier rsync command. !! repeats only the immediately previous command, and !!rsync would append the text rsync to it instead of searching history.

    Open this question
  4. Question 204

    System Management

    An administrator runs virsh destroy web02 on a running KVM guest that has stopped responding. The administrator then runs virsh list --all. Which description matches the result?

    Show the answer

    Correct answerA. The guest is listed as shut off, and its definition and disk image remain.

    virsh destroy forcibly powers off the guest, like pulling the power cord, so it shows as shut off while its definition and disks stay and it can be started again. It does not delete the guest; removing the definition is done with virsh undefine.

    Open this question
  5. Question 205

    System Management

    A KVM guest named app is running, and its disk is /var/lib/libvirt/images/app.qcow2. An administrator runs qemu-img info on the file and gets an error that it failed to get a shared 'write' lock because the image is in use. The administrator must read the format and virtual size without stopping the guest. Which command does this?

    Show the answer

    Correct answerC. qemu-img info -U /var/lib/libvirt/images/app.qcow2

    The -U (--force-share) option opens the image in shared mode, so qemu-img info can read it while QEMU holds the lock. The check -r all command tries to repair the image, which can corrupt a disk that is in use and does not bypass the lock.

    Open this question
  6. Question 206

    System Management

    A web server is slow during peak load. An administrator suspects the system is holding a very large number of sockets in the TIME-WAIT state. She wants only a compact summary of total socket counts by type and TCP state, not a line for every connection. Which command provides this?

    Show the answer

    Correct answerA. ss -s

    ss -s prints summary statistics, including totals for each socket type and TCP state counts such as timewait. ss -tan lists every TCP socket with numeric addresses, which is the long per-connection output she wants to avoid.

    Open this question