{"id":59115,"date":"2022-04-23T18:01:46","date_gmt":"2022-04-23T10:01:46","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=59115"},"modified":"2025-04-03T23:07:25","modified_gmt":"2025-04-03T15:07:25","slug":"linux-command-tar","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/","title":{"rendered":"How to Compress and Extract Files with TAR in Linux"},"content":{"rendered":"<p>The <code>tar<\/code> command stands for \u201ctape archive\u201d and the basic Unix command to archive files. By default the command will save the archive in a <code>.tar<\/code> file but it can also save it to a gzip file with the <code>.gz<\/code> extension. The tar command typically is available in most <a href=\"https:\/\/www.hongkiat.com\/blog\/best-desktop-linux-distributions\/\">Linux distro<\/a>.<\/p>\n<p>There are also some alternatives such as the <code>gzip<\/code> and <code>gunzip<\/code> which specially handles the .gz file and <code>unzip<\/code> which is for the .zip extension. These alternatives may not always be available so check the distro package manager if they can be installed as an additional command.<\/p>\n<p>General syntax for <code>tar<\/code> command:<\/p>\n<pre>\r\ntar [OPTIONS] [FILES]...\r\n<\/pre>\n<h3>1. Create an archive<\/h3>\n<pre>tar -cf [archive] [file]<\/pre>\n<p>The <code>-c<\/code> and <code>-f<\/code> options create a new archive file with the files specified to be archived.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre>tar -cf example.tar new1.txt new2.txt<\/pre>\n<p>Here\u2019s a breakdown of what each part of the command does:<\/p>\n<ul>\n<li>\n<p><code>-c<\/code>: This option tells tar to create a new archive.<\/p>\n<\/li>\n<li>\n<p><code>-f<\/code>: This option allows you to specify the name of the archive file. In this case, the name of the archive file is example.tar.<\/p>\n<\/li>\n<li>\n<p><code>example.tar<\/code>: This is the name of the archive file that you\u2019re creating.<\/p>\n<\/li>\n<li>\n<p><code>new1.txt new2.txt<\/code>: These are the files that you\u2019re adding to the archive. In this case, you\u2019re adding two files, <code>new1.txt<\/code> and <code>new2.txt<\/code>, to the archive.<\/p>\n<\/li>\n<\/ul>\n<p>So, the command <code>tar -cf example.tar new1.txt new2.txt<\/code> creates a new archive file named <code>example.tar<\/code> and adds the files <code>new1.txt<\/code> and <code>new2.txt<\/code> to this archive. Do note that archive file is not compressed; it\u2019s simply a collection of the files.<\/p>\n<hr>\n<h3>2. List contents of an archive<\/h3>\n<pre>tar -tf [archive]<\/pre>\n<p>The <code>-t<\/code> option allows you to view the contents of the archive file without decompressing it.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>Assuming <code>example.tar<\/code> is a tar archive that contains the files <code>file1.txt<\/code>, <code>file2.txt<\/code>, and a directory named <code>dir1<\/code> with a file <code>file3.txt<\/code> inside it, the output would look something like this:<\/p>\n<pre>file1.txt\r\nfile2.txt\r\ndir1\/\r\ndir1\/file3.txt\r\n<\/pre>\n<hr>\n<h3>3. Create a Gzip archive<\/h3>\n<pre>tar czf [archive.tar.gz] [file]<\/pre>\n<p>Use the <code>-z<\/code> option with the <code>tar<\/code> command to create a new archive using gzip compression.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to create a gzip compressed tar file named <code>example.tar.gz<\/code> and zip <code>new1.txt<\/code> and <code>new2.txt<\/code> into it, you would use the following command:<\/p>\n<pre>tar -czf example.tar.gz new1.txt new2.txt\r\n<\/pre>\n<hr>\n<h3>4. Extract an archive<\/h3>\n<pre>tar -xf [archive]<\/pre>\n<p>The <code>-x<\/code> option allows you to extract files from an archive to your current working directory. It is also possible to extract certain files by specifying the file names.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to extract the <code>example.tar<\/code> archive that contains the text files <code>new1.txt<\/code> and <code>new2.txt<\/code>, you would use the following command:<\/p>\n<pre>tar -xf example.tar\r\n<\/pre>\n<p>After running this command, the files <code>new1.txt<\/code> and <code>new2.txt<\/code> will be extracted from the example.tar archive and will be available in the current directory. If the files were stored in the archive with a directory structure, that structure will be recreated in the current directory.<\/p>\n<hr>\n<h3>5. Add files to an existing archive<\/h3>\n<pre>tar -rf [archive] [file_to_add]<\/pre>\n<p>To append a file or directory to an existing tar archive file, use the <code>-r<\/code> option. This option adds files to the end of an archive.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to add the <code>new1.txt<\/code> file to the <code>example.tar<\/code> archive, you would use the following command:<\/p>\n<pre>tar -rf example.tar new1.txt\r\n<\/pre>\n<p>After running this command, the <code>new1.txt<\/code> file will be added to the end of the <code>example.tar<\/code> archive.<\/p>\n<hr>\n<h3>6. Merge archives<\/h3>\n<pre>tar -Af [archive] [archive_to_be_added]<\/pre>\n<p>The <code>-A<\/code> or <code>--concatenate<\/code> or <code>--catenate<\/code> option tells tar to append tar files to an archive, and the <code>-f<\/code> option specifies the file to use.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to merge the files of the <code>file1.tar<\/code> archive into the <code>file2.tar<\/code> archive, you would use the following command:<\/p>\n<pre>tar -Af file2.tar file1.tar\r\n<\/pre>\n<p>After running this command, the files from <code>file1.tar<\/code> will be appended to the <code>file2.tar<\/code> archive.<\/p>\n<hr>\n<h3>7. Delete a file from an archive<\/h3>\n<pre>tar --delete -f [archive] [file]<\/pre>\n<p>The <code>--delete<\/code> option allows you to delete a file or multiple files from an archive at once.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>To remove the <code>new1.txt<\/code> file from the <code>example.tar<\/code> archive, you would use the following command:<\/p>\n<pre>tar --delete -f example.tar new1.txt\r\n<\/pre>\n<p>After running this command, the <code>new1.txt<\/code> file will be removed from the <code>example.tar<\/code> archive.<\/p>\n<hr>\n<h3>8. Find differences between archive and file<\/h3>\n<pre>tar -df [archive] [file]<\/pre>\n<p>To determine the differences between an archive and a file, use the <code>-d<\/code> option.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to find the difference between the <code>example.tar<\/code> archive and the <code>new1.txt<\/code> file, you would use the following command:<\/p>\n<pre>tar -df example.tar new1.txt\r\n<\/pre>\n<p>After running this command, <code>tar<\/code> will compare the <code>new1.txt<\/code> file in the file system with the <code>new1.tx<\/code>t file in the <code>example.tar<\/code> archive and report any differences.<\/p>\n<hr>\n<h3>9. Add only new files to the archive<\/h3>\n<pre>tar -uf [archive] [files_to_add]<\/pre>\n<p>Use the <code>-u<\/code> option to add files that are newer than the file in the archive. The newer files do not overwrite the older ones in the archive.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If you want to append all new text files from the current directory to the <code>example.tar<\/code> archive, you would use the following command:<\/p>\n<pre>tar -uf example.tar *.txt\r\n<\/pre>\n<p>After running this command, all new text files (<code>*.txt<\/code>) in the current directory will be appended to the <code>example.tar<\/code> archive.<\/p>\n<hr>\n<h3>10. Extract archive to a specific directory<\/h3>\n<pre>tar -xf [archive] -C [dirpath]<\/pre>\n<p>The <code>-C<\/code> option allows you to extract the archive to a certain directory by specifying the destination path.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>To extract the <code>example.tar<\/code> archive to the <code>dir\/test<\/code> folder, you would use the following command:<\/p>\n<pre>tar -xf example.tar -C dir\/test\r\n<\/pre>\n<h3 style=\"padding-bottom:10px\">More Linux commands:<\/h3>\n<table>\n<tbody>\n<tr>\n<td width=\"150\">Directory Operations<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-rm-rmdir\/\"><code>rmdir<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-cd\/\"><code>cd<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-pwd\/\"><code>pwd<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-exa\/\"><code>exa<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-ls\/\"><code>ls<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">File Operations<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-cat\/\"><code>cat<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-cp\/\"><code>cp<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-dd\/\"><code>dd<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-less\/\"><code>less<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-touch\/\"><code>touch<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-ln\/\"><code>ln<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-rename\/\"><code>rename<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-more\/\"><code>more<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-head\/\"><code>head<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">File System Operations<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-chown\/\"><code>chown<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-mkfs\/\"><code>mkfs<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-locate\/\"><code>locate<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">Networking<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-ping\/\"><code>ping<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-curl\/\"><code>curl<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-wget\/\"><code>wget<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-iptables\/\"><code>iptables<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-mtr\/\"><code>mtr<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">Search and Text Processing<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-find\/\"><code>find<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-grep\/\"><code>grep<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-sed\/\"><code>sed<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-whatis\/\"><code>whatis<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-ripgrep\/\"><code>ripgrep<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-fd\/\"><code>fd<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-tldr\/\"><code>tldr<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">System Information and Management<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-env\/\"><code>env<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-history\/\"><code>history<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-top\/\"><code>top<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-who\/\"><code>who<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-htop\/\"><code>htop<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-glances\/\"><code>glances<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-lsof\/\"><code>lsof<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td width=\"150\">User and Session Management<\/td>\n<td><a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-screen\/\"><code>screen<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-su\/\"><code>su<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-sudo\/\"><code>sudo<\/code><\/a> \u00b7 <a href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-open\/\"><code>open<\/code><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>","protected":false},"excerpt":{"rendered":"<p>The tar command stands for \u201ctape archive\u201d and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it can also save it to a gzip file with the .gz extension. The tar command typically is available in most Linux distro. There are also some&hellip;<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3397],"tags":[888,3316],"topic":[],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Compress and Extract Files with TAR in Linux - Hongkiat<\/title>\n<meta name=\"description\" content=\"The tar command stands for &quot;tape archive&quot; and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Compress and Extract Files with TAR in Linux\" \/>\n<meta property=\"og:description\" content=\"The tar command stands for &quot;tape archive&quot; and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-23T10:01:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T15:07:25+00:00\" \/>\n<meta name=\"author\" content=\"Hongkiat.com\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hongkiat.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/\"},\"author\":{\"name\":\"Hongkiat.com\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/7cc686597d92f9086729e4bcc1577ba3\"},\"headline\":\"How to Compress and Extract Files with TAR in Linux\",\"datePublished\":\"2022-04-23T10:01:46+00:00\",\"dateModified\":\"2025-04-03T15:07:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/\"},\"wordCount\":760,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"keywords\":[\"Linux\",\"Linux Commands\"],\"articleSection\":[\"Desktop\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/\",\"name\":\"How to Compress and Extract Files with TAR in Linux - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-04-23T10:01:46+00:00\",\"dateModified\":\"2025-04-03T15:07:25+00:00\",\"description\":\"The tar command stands for \\\"tape archive\\\" and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/linux-command-tar\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Compress and Extract Files with TAR in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/7cc686597d92f9086729e4bcc1577ba3\",\"name\":\"Hongkiat.com\",\"description\":\"This post is published by an HKDC (hongkiat.com) staff. (I.e., intern, staff writer, or editor).\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Compress and Extract Files with TAR in Linux - Hongkiat","description":"The tar command stands for \"tape archive\" and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/","og_locale":"en_US","og_type":"article","og_title":"How to Compress and Extract Files with TAR in Linux","og_description":"The tar command stands for \"tape archive\" and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it","og_url":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2022-04-23T10:01:46+00:00","article_modified_time":"2025-04-03T15:07:25+00:00","author":"Hongkiat.com","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Hongkiat.com","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/"},"author":{"name":"Hongkiat.com","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/7cc686597d92f9086729e4bcc1577ba3"},"headline":"How to Compress and Extract Files with TAR in Linux","datePublished":"2022-04-23T10:01:46+00:00","dateModified":"2025-04-03T15:07:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/"},"wordCount":760,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"keywords":["Linux","Linux Commands"],"articleSection":["Desktop"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/","url":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/","name":"How to Compress and Extract Files with TAR in Linux - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"datePublished":"2022-04-23T10:01:46+00:00","dateModified":"2025-04-03T15:07:25+00:00","description":"The tar command stands for \"tape archive\" and the basic Unix command to archive files. By default the command will save the archive in a .tar file but it","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/linux-command-tar\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Compress and Extract Files with TAR in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/7cc686597d92f9086729e4bcc1577ba3","name":"Hongkiat.com","description":"This post is published by an HKDC (hongkiat.com) staff. (I.e., intern, staff writer, or editor).","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/com\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-fnt","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/59115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=59115"}],"version-history":[{"count":4,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/59115\/revisions"}],"predecessor-version":[{"id":73463,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/59115\/revisions\/73463"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=59115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=59115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=59115"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=59115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}