tar Command – Basic Archiving Updated on August 16, 2021 by InMotion Hosting Contributor 1 Minutes, 16 Seconds to Read Learn how to create, extract, and list files within a compressed tar archive in Secure Shell (SSH), or cPanel Terminal, with the tar command. Create an archiveExtract FilesList Archived Files Want to spend more time working on your website than setup? Check out our Shared Business Hosting with Softaculous Instant Installer and WP-CLI included. Create an Archive tar -czvf archive-name.tar.gz path-to-directory-or-files Example: tar -czvf images.tar.gz *.png – Archive all PNG image files in the current directory into a images.tar.gz fileExample: tar -czvf backup.tar.gz * – Archive all files and folders in the current directory into a backup.tar.gz file -c – create -z – compress or decompress -v – list files processed -f – specify filename Extract Files tar -xzvf archive.tar.gz Example: tar -xzvf images.tar.gz Used options: -x – Extract -z – compress or decompress -v – list files processed -f – specify filename Extract to Another Directory tar -xzvf archive.tar.gz -C another-folder Example: tar -xzvf images.tar.gz -C restored – Extract files from the images.tar.gz file into an existing /restored folder Used options: -x – Extract -z – compress or decompress -v – list files processed -f – specify filename -C – Specify directory List Files tar -tvf archive.tar.gz Used options: -t – list files processed -v – list files processed (with more info including file size and date modified) -f – specify filename For more options, type the tar --help command or visit GNU.org. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Understanding Linux Operating Systems How to Install Python 3.9 on CentOS 7 Speed Up grep Searches with LC_ALL=C How To Install RubyGems On Linux unrar and rar Commands 5 Ways to Find a File in Linux Setting Your PHP Settings in Command Line How to Check the Memory Usage on Linux How to Send Files to the Trash Can in Linux with Gio Trash How to Merge PDF Files in the Linux Terminal