tar directory linux code example

Example 1: tar a directory linux

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Example 2: gzip folder with tar

# gzip my-folder-name
#
# flags:
# 	z = filter the archive through gzip
# 	c = create a new archive
# 	v = verbosely list files processed
# 	f = use archive file or device ARCHIVE
#
# Example:
tar -zcvf my-filename.tar.gz my-folder-name

Example 3: linux zip a directory

zip -r filename.zip /path/to/folder1

Example 4: tar directory

tar -czvf archive.tar.gz stuff

Example 5: tar to directory

tar -xf file_name.tar -C /target/directory

Example 6: tar a directory linux

tar a directory linux

Tags:

Misc Example