cli-tarHow do I use the command line to tar a folder?
The command line utility tar
can be used to create an archive file from a folder. To use tar
to tar a folder, the command tar -cvf <archive-name>.tar <directory>
should be used. The -c
flag tells tar
to create an archive, the -v
flag tells tar
to be verbose and show the progress of the archive creation, and the -f
flag tells tar
the name of the archive file to create.
For example, to create an archive of the folder my-folder
and name it my-archive.tar
, the following command should be used:
tar -cvf my-archive.tar my-folder
The output of this command should look something like this:
my-folder/
my-folder/file1.txt
my-folder/file2.txt
my-folder/file3.txt
The parts of the command are:
tar
: The command line utility to create an archive file-c
: The flag to telltar
to create an archive-v
: The flag to telltar
to be verbose and show the progress of the archive creation-f
: The flag to telltar
the name of the archive file to createmy-archive.tar
: The name of the archive file to createmy-folder
: The directory of the folder to be archived
For more information, see the following links:
More of Cli Tar
- How can I use tar commands to zip a file?
- How do I use the command line to tar and zip files?
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip a file?
- How do I use the shell to tar and zip files?
- How do I use the Unix tar zip command?
- How do I create a tar.zip file in Unix?
- How do I use the command line to tar and zip a file?
- How do I use the command line to tar and distribute files?
- How do I use the Unix tar xvf command to extract files?
See more codes...