.Dd Created:2025-10-03|Updated:2025-10-07| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt TAR oh .Os OpenBSD 7.7 linux| .Nm tar .Nd archive tool: usage .Sh SYNOPSIS .Dl tar -zvcf TAR_FILE DIRECTORY .Dl tar -zvcf TAR_FILE DIRECTORY/* .Dl tar -zvxd TAR_FILE .Sh OPTIONS .Bl -column ".Sy -o TAR_FILE " .It -c Ta : compress .It -x Ta : extract .It -v Ta : verbose .It -f TAR_FILE Ta : use specified TAR_FILE .It -z Ta : use gzip compression .It -j Ta : use bzip2 compression .It -t Ta : list archive contents .It -C DIR Ta : cd to directory .El The options can be collapsed but f needs to be the last option. Eg.: .Dl tar -zvxf tar_file .Ss extracting specific files .obdi Filename(s) can be specified to extract only specified file(s). .oit The full path inside the tar file needs to be specified. .El .obdl $ tar -ztf tar_file d1/file1 d2/file2 $ tar -zxf tar_file d1/file1 .Ed .Ss Using -C .Bl -dash -compact .It Compress the contents of dir_to_compress located in parent_directory into dir.tar.gz. .Bd -literal -compact $ pwd cur_directory $ ls parent_directory dir_to_compress $ tar -C parent_directory -zcf dir.tar.gz dir_to_compress $ ls parent_directory dir.tar.gz .Ed .It Extract the contents of TAR_FILE into EXTRACT_DIR. .Dl $ tar -C EXTRACT_DIR -zxf TAR_FILE .Sh SEE ALSO .opsy OpenBSD manpages: .Xr tar 1 .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com