exam questions

Exam XK0-004 All Questions

View all questions & answers for the XK0-004 exam

Exam XK0-004 topic 1 question 197 discussion

Actual exam question from CompTIA's XK0-004
Question #: 197
Topic #: 1
[All XK0-004 Questions]

A raw VM image is being compressed with bzip2 and copied to a flash drive at /dev/hdb for off-site use by the marketing department. Which of the following command lines accomplishes this task?

  • A. mv /vm/mkgt.img | bzip2 /dev/hdb/mkgt.img.bz2
  • B. bzip2 ג€"c /vm/mktg.img | dd of=/dev/hdb
  • C. cp /vm/mktg.img | bzip2 /dev/hdb/mktg.img.bz2
  • D. cp ג€"a ג€"r /vm/mktg.img bzip2 /dev/hdb/mktg.img.zip
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
FilipIT
Highly Voted 4 years, 3 months ago
Correct answer is B
upvoted 9 times
...
Sfutrell
Highly Voted 4 years, 1 month ago
B won't work, because you have the bzip2 command and then only half of the dd cmd. you cant just have an output to dd, you also need an input. Also running bzip2 with dd makes no sense.
upvoted 5 times
shahin_am2
3 years, 11 months ago
B is correct while the dd command can take an input from a pipe!
upvoted 6 times
...
Linux1020
3 years ago
B will work, look at the man pages for bzip, the -c command is a valid argument. The command says send the std out of the command to a byte by byte copy (dd) of the /dev/hdb location.
upvoted 2 times
...
shahin_am2
3 years, 11 months ago
bzip2 -c mktg.img | dd of=/home/shahin/hosts-test/copiedfile.img 0+1 records in 0+1 records out 14 bytes copied, 3.927e-05 s, 357 kB/s --------------------------------------------------------------------- ls -la .rw-rw-r-- shahin shahin 14 B Sun May 16 16:59:36 2021  copiedfile.img
upvoted 8 times
...
...
Nathanf123
Most Recent 3 years, 2 months ago
So what makes C incorrect ?
upvoted 1 times
luken7777
1 year, 9 months ago
The whole syntax is terribly wrong. First of all, missing destination for cp command. Right syntax would be cp 'file-you-want-copy' 'destination'. Secondly, you cannot copy any file to the location of the device like /dev/sdb.
upvoted 1 times
...
...
rjrpaz
3 years, 11 months ago
B does work indeed. Adding "-c" to bzip2 will write the compressed info to STDOUT. Also, the pipe send that to "dd" command. When used with a pipe, there is no need to provide "if" attribute to dd command. Thie can be tested like this: "bzip2 -c file | dd of=compressed_file.bz2"
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago