TAR(oh) LOCAL TAR(oh) tar - archive tool: usage SYNOPSIS tar -zvcf TAR_FILE DIRECTORY tar -zvcf TAR_FILE DIRECTORY/* tar -zvxd TAR_FILE OPTIONS -c : compress -x : extract -v : verbose -f TAR_FILE : use specified TAR_FILE -z : use gzip compression -j : use bzip2 compression -t : list archive contents -C DIR : cd to directory The options can be collapsed but f needs to be the last option. Eg.: tar -zvxf tar_file extracting specific files - Filename(s) can be specified to extract only specified file(s). - The full path inside the tar file needs to be specified. $ tar -ztf tar_file d1/file1 d2/file2 $ tar -zxf tar_file d1/file1 Using -C - Compress the contents of dir_to_compress located in parent_directory into dir.tar.gz. $ 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 - Extract the contents of TAR_FILE into EXTRACT_DIR. $ tar -C EXTRACT_DIR -zxf TAR_FILE SEE ALSO - OpenBSD manpages: tar(1) AUTHORS ohazot(oh) | about(oh) | ohazot.com: https://ohazot.com OpenBSD 7.7 linux| Created:2025-10-03|Updated:2025-10-07| TAR(oh)