Which command creates an archive file work.tar from the contents of the directory ./work/?

Prepare for the LPI Linux Essentials 010-160 Test. Study with flashcards and multiple choice questions, each question offers hints and explanations. Get ready to ace your exam!

The command that creates an archive file named work.tar from the contents of the directory ./work/ is correctly identified as tar -cf work.tar ./work/.

The tar command is specifically designed for creating and manipulating archive files. In this case, the flags -c and -f are used. The -c flag stands for "create," indicating that a new archive is being created, while the -f flag specifies the filename of the archive to be created, which in this case is work.tar. Following these flags, the path to the directory you want to archive is provided, which is ./work/.

This command effectively bundles the contents of the specified directory into a single file, work.tar, which can then be easily moved or stored. It's an essential command for backup and file management in a Linux environment.

Other commands, such as using zip with the -r option or trying to extract files with the -x flag or copying a directory with cp, do not align with the goal of creating a tar archive, thus making them unsuitable in this context.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy