9951 explained code solutions for 126 technologies


cli-tarHow do I use the Unix tar command?


The Unix tar command is used to create, modify, and extract files from an archive file. It is commonly used to compress multiple files into a single archive file.

Example

tar -cvf my_archive.tar file1 file2

This command will create a tar file named my_archive.tar containing the files file1 and file2.

Code explanation

  • tar: The command to execute
  • c: Create a new archive
  • v: Verbose output to show progress
  • f: Specify the archive filename
  • file1 and file2: The files to add to the archive

Helpful links

Edit this code on GitHub