IT CertificationsAnswer Key

Comptia Cheese

23 community-sourced questions and answers. Free — no login.

Community-sourced. Answers may be wrong or out of date. Always verify with your official training portal before submitting. Not affiliated with any branch, agency, or vendor. Details.
QUESTION 1

What command will return the value of the variable PATH in the shell?

ANSWER

echo $PATH

QUESTION 2

What options will return the contents of the variable myVar?

ANSWER

echo $myVar

QUESTION 3

Complete the code to use the cpio command to extract the files from /images.cpio and place them in that same directory, recreating any required subdirectories.

ANSWER

-i -d ??

QUESTION 4

Write the command that will copy all subdirectories recursively in /images in the backup folder /imgbak

ANSWER

cp -r /images /imgbak

QUESTION 5

You've opened a text file using vi and now you want to search for instances of the string mark. As mark can be a verb as well as a name you want to make your search case insensitive. Which option will perform this query?

ANSWER

/mark\c

QUESTION 6

Which command will modify the date and time stamp on an existing file?

ANSWER

touch [a-z][a-z][a-z]0?

QUESTION 7

Write the command that would return any files owned by emclampett that are in the /images directory

ANSWER

find /images -user emclampett

QUESTION 8

You've run history command in the bash shell and now you want to execute the command listed 39th. Which option will do this?

ANSWER

!39

QUESTION 9

Which component of this command will specify the path and name of the file in which all of the archived files will exist? tar -zcvf /images.tar

ANSWER

f

QUESTION 10

You want to search cheese.txt for instances of the string blue, but you don't want the search to be case sensitive.

ANSWER

-i

QUESTION 11

Which of the following commands will open the mainlist.txt text file in a command-line text editor?

ANSWER

vi mainlist.txt

QUESTION 12

Which operator could you use to mimic an IF statement on the command line?

ANSWER

ll

QUESTION 13

Using gedit as your text editor, complete the query to search the snacks directory and open the files inside. find /home/snacks/*.txt |

ANSWER

gedit??

QUESTION 14

Complete the code to recursively copy all files in the current directory to the /backup001 directory. Make sure the code also returns what files have been copied.

ANSWER

-rv?? Maybe just -v

QUESTION 15

Which command will remove the files and directories recursively from /images without prompting for confirmation before removing each file?

ANSWER

rm -rv /images

QUESTION 16

Write the command to compress every file contained in the /images directory using the fastest compression command.

ANSWER

gzip -r /images

QUESTION 17

Which option will return all files including hidden ones?

ANSWER

ls -a ~

QUESTION 18

Complete the command that will add the /images directory to the PATH variable

ANSWER

/images ??

QUESTION 19

You used to vi to open a text file and now you want to edit it. What options represent the keys you can press that will allow you to actually edit the contents?

ANSWER

i a

QUESTION 20

Which statement about the piping of output is accurate?

ANSWER

Piping is accessed using the | symbol

QUESTION 21

Which command will allow you to reopen a file without saving any changes?

ANSWER

:e!

QUESTION 22

Which statement best describes the purpose of the tee command

ANSWER

It allows you to write standard output to the screen and additional locations

QUESTION 23

Which command will allow you to replace the string red with the string blue in a text file without being asked for confirmation?

ANSWER

:%s /red/blue

Looking for a different version?

CBTs get updated every year. Search for the exact version you're taking (e.g. "cyber awareness 2025").

Search all study materials