The tar
command in Linux is used for creating and manipulating archive files. It stands for “tape archive” and is commonly used to combine multiple files into a single file for easier storage or transfer. You can combine it with other utilities like gzip
or bzip2
for compression, making it an essential part of file management and backup strategies. If you have any specific questions or need further examples, feel free to ask!
tar
Command Options.tar
archive:tar -cvf archive_name.tar /path/to/directory
c
: Create a new archive.v
: Verbose mode (shows files being processed).f
: Specify the archive file name..tar
archive:tar -xvf archive_name.tar
x
: Extract files from an archive.tar -tvf archive_name.tar
t
: List the contents of an archive.tar -czvf archive_name.tar.gz /path/to/directory
z
: Compress the archive using gzip..tar.gz
archive:tar -xzvf archive_name.tar.gz
tar -cjvf archive_name.tar.bz2 /path/to/directory
j
: Compress using bzip2..tar.bz2
archive:tar -xjvf archive_name.tar.bz2