Forrest logo
back to the tar tool

linux:tar:create:tar

[c]reate an archive and write it to a [f]ile.
$ tar cf ${path-to-target-tar} ${filename1 filename2 ---}
try on your machine

The command "tar cf ${path-to-target-tar} ${filename1 filename2 ---}" creates a tar archive file named ${path-to-target-tar} that contains the specified files, ${filename1 filename2}, etc.

  • "tar" stands for "tape archive" and is a command-line utility in Unix-like operating systems that is used to create, store, and extract files from a single archive file.
  • "cf" are options specified to tar where "c" means to create a new archive and "f" means to specify the filename of the tar archive.
  • ${path-to-target-tar} is the path and name of the tar archive file that will be created by the command.
  • ${filename1 filename2 ---} are one or more file names (separated by space) which will be included in the tar archive file. The "---" indicates that multiple files can be specified here.

So, the overall functionality of this command is to create a tar archive file that contains the specified files.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tar tool