The correct command to create an archive file work.tar from the contents of the directory ./work/ is tar –cf work.tar ./work/. This command uses the -c option to create a new archive, the -f option to specify the file name, and the ./work/ argument to indicate the source directory. The other commands are incorrect for various reasons:
A. tar --new work.tar ./work/ is incorrect because there is no --new option in the tar command. The correct option for creating a new archive is --create or -c.
C. tar –create work.tgz –content ./work/ is incorrect because the -content option is not valid. The correct option for specifying the source files or directories is --files-from or -T. Also, the work.tgz file name implies compression, but the command does not use any compression option such as -z, -j, or -J.
D. tar work.tar < ./work/ is incorrect because the tar command does not accept input redirection from the standard input. The correct way to use the tar command is to provide the options and arguments after the command name.
E. tar work > work.tar is incorrect because the tar command does not produce output redirection to the standard output. The correct way to use the tar command is to use the -f option to specify the output file name. References: : tar command in Linux with examples - GeeksforGeeks : tar Command in Linux With Examples | phoenixNAP KB
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit