{"id":765,"date":"2016-02-17T17:11:01","date_gmt":"2016-02-17T15:11:01","guid":{"rendered":"http:\/\/www.systemcodegeeks.com\/?p=765"},"modified":"2018-05-31T16:13:10","modified_gmt":"2018-05-31T13:13:10","slug":"linux-tar-examples","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/","title":{"rendered":"Linux tar Examples"},"content":{"rendered":"<p>In this post, we feature a comprehensive Linux tar Examples. I am a real fan of learning Linux commands by examples and from my personal experience it will really help to see some Linux tar command examples. But first, a brief bit of background information. The name &#8220;tar&#8221; stands for &#8220;tape archive&#8221;.<\/p>\n<p>As that name implies, originally it was a command that Unix administrators used to deal with tape drives. Where we now use the Linux tar command to create a tar file, we used to tell it to write the tar archive to a device file (e.g in \/dev).<\/p>\n<p>Nowadays the Linux tar command is more often used to create compressed archives that can easily be moved around, from one disk to anther disk or machine to machine, in other words we can call it as backup utility and its been used in most of the Unix flavors. One user may archive a large collection of files, and another user may extract those files, with both of them using the tar command.<br \/>\n[ulp id=&#8217;SG9vnnKgRCD7iZxf&#8217;]<\/p>\n<h2>1. Create a tar archive of a directory<\/h2>\n<p>In this example we will come to know basic tar command using option &#8216;cvf&#8217; to create a tar archive.<br \/>\nHere we are creating a tar file &#8216;my-archive.tar&#8217; for a directory &#8216;\/home\/my-directory&#8217; in current working directory:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar cvf my-archive.tar \/home\/my-directory<\/pre>\n<p>c \u2013 Creates a new .tar archive file<br \/>\nv \u2013 Verbosely list files which are processed<br \/>\nf \u2013 File name type of the archive file<\/p>\n<h2>2. Create a zipped archive<\/h2>\n<p>In order to make tar ball as zipped archive , we need to use the option &#8220;z&#8221;.<br \/>\nIn below example the command will make &#8220;my-archive.tar.gz&#8221; for a directory &#8220;\/home\/my-directory&#8221; in current working directory.<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar cvzf my-archive.tar.gz \/home\/my-directory<\/pre>\n<h2>3. List the contents of a tar archive<\/h2>\n<p>To list the contents of an uncompressed tar archive, just replace the cflag with the tflag, like this:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar tvf my-archive.tar<\/pre>\n<p>This lists all the files in the archive, but does not extract them.<br \/>\nTo list all the files in a compressed archive, add the zflag like before:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar tzvf my-archive.tgz<\/pre>\n<p>or for a tar.gz archive:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar tzvf my-archive.tar.gz<\/pre>\n<h2>4. Extract tar archive contents<\/h2>\n<p>To extract the contents of a Linux tar archive, now just replace the tflag with the x(&#8220;extract&#8221;) flag. For uncompressed archives the extract command looks like this:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvf my-archive.tar<\/pre>\n<p>For compressed archives the tar extract command looks like this:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xzvf my-archive.tar.gz<\/pre>\n<p>or this for *.tgz:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xzvf my-archive.tgz<\/pre>\n<h2>5. Extract tar.bz2 archive contents<\/h2>\n<p>In order to extract the contents of a *.tar.bz2 file the options are &#8220;xj&#8221;.<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvjf my-archive.tar.bz2<\/pre>\n<p>The below image illustrates the commands seen so far:<\/p>\n<figure id=\"attachment_785\" aria-describedby=\"caption-attachment-785\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_1.jpg\" rel=\"attachment wp-att-785\"><img decoding=\"async\" class=\"wp-image-785 size-full\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_1.jpg\" alt=\"Linux tar Examples: Tar Commands (1)\" width=\"860\" height=\"650\" \/><\/a><figcaption id=\"caption-attachment-785\" class=\"wp-caption-text\">Tar Commands (1)<\/figcaption><\/figure>\n<h2>6. Extract a single file from tar archive<\/h2>\n<p>To extract a specific file from a tar archive, specify the file name at the end of the tar xvf command as shown below. The following command extracts only a specific file (my-file.sh) in the current directory from a large tar file.<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvf my-archive.tar my-file.sh<\/pre>\n<h2>7. Create a compressed archive of the current directory<\/h2>\n<p>Many times when using the Linux tar command you will want to create an archive of all files in the current directory, including all subdirectories. You can easily create this archive like this:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar czvf my-directory.tgz .<\/pre>\n<p>In the above example, the &#8216;.&#8217; at the end of the command is how you refer to the current directory.<\/p>\n<h2>8. Create an archive in a different directory<\/h2>\n<p>You may also want to create a new tar archive like that previous example in a different directory, like this:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar czvf \/tmp\/my-directory.tgz .<\/pre>\n<p>As you can see, you just add a path before the name of your tar archive to specify what directory the archive should be created in.<\/p>\n<h2>9. Extract a single directory from tar archive<\/h2>\n<p>To extract a single directory (along with its subdirectory and files) from a tar archive, specify the directory name at the end of the tar xvf command as shown below. The following extracts only a specific directory from a large tar file:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvf my-archive.tar home\/my-directory\/<\/pre>\n<p>Check below image for examples 6-9:<\/p>\n<figure id=\"attachment_786\" aria-describedby=\"caption-attachment-786\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_2.jpg\" rel=\"attachment wp-att-786\"><img decoding=\"async\" class=\"wp-image-786 size-full\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_2.jpg\" alt=\"Linux tar Examples: Tar Commands (2)\" width=\"860\" height=\"648\" \/><\/a><figcaption id=\"caption-attachment-786\" class=\"wp-caption-text\">Tar Commands (2)<\/figcaption><\/figure>\n<h2>10. Extract a single directory from tar.gz archive<\/h2>\n<p>We just need to add \u201cz\u201d to the above extract command \u201cxvf\u201d<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvzf my-archive.tar.gz home\/my-directory\/<\/pre>\n<h2>11. Check the size of the tar, tar.gz and tar.bz2 Archive File<\/h2>\n<p>For any tar, tar.gz and tar.bz2 archive file, the below commands will display the size of archive file in Kilobytes (KB):<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -cf - my-archive.tar | wc -l<\/pre>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -czf - my-archive.tar.gz | wc -l<\/pre>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -cjf  - my-archive.tar.bz2 | wc -l<\/pre>\n<h2>12. Verify integrity of tar file<\/h2>\n<p>As part of creating a tar file, you can verify the integrity of the archive file that got created using the option \u201cW\u201d as shown below:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar tvfW my-archive.tar<\/pre>\n<p>If an output line starts with Verify, and there is no differs line then the file\/directory is OK. If not, you should investigate the issue.<\/p>\n<p>Note: for a compressed archive file ( *.tar.gz, *.tar.bz2 ) you cannot do the verification.<\/p>\n<h2>13. Find the difference between an archive and file system<\/h2>\n<p>Finding the difference between an archive and file system can be done even for a compressed archive. It also shows the same output as above excluding the lines with Verify.<\/p>\n<p>Finding the difference between gzip archive file and file system:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar dfz my-archive.tgz<\/pre>\n<p>Finding the difference between bzip2 archive file and file system:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar dfj my-archive.tar.bz2<\/pre>\n<h2>14. Delete a file from tar ball<\/h2>\n<p>You can use the following syntax to delete a file from a tar ball:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar --delete -f my-archive.tar home\/my-file<\/pre>\n<h2>15. Add a file to an existing archive<\/h2>\n<p>You can add additional files to an existing tar archive with \u201cr\u201d option:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar rvf my-archive.tar my-file<\/pre>\n<h2>16. Add a directory to an existing archive<\/h2>\n<p>Adding a directory is also the same. We need to mention the directory name instead of the file name:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar rvf my-archive.tar my-dir\/<\/pre>\n<h2>17. Extract group of files from tar, tar.gz, tar.bz2 archives using regular expression<\/h2>\n<p>You can specify a regular expressions , to extract files matching a specified pattern. For example, the following tar command extracts all the files whose file ends with .java:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xvf my-archive.tar  --wildcards '*.java'<\/pre>\n<h2>18. Untar multiple files from tar, tar.gz and tar.bz2 File<\/h2>\n<p>To extract or untar multiple files from the tar, tar.gz and tar.bz2 archive file. For example the below command will extract \u201cmy-file-1\u201d \u201cmy-file-2\u201d and &#8220;my-file-3&#8221; from the archive files:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -xvf my-archive.tar \"my-file-1\" \"my-file-2\" \"my-file-3\"<\/pre>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -zxvf my-archive.tar.gz \"my-file-1\" \"my-file-2\" \"my-file-3\"<\/pre>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar -jxvf my-archive.tar.bz2 \"my-file-1\" \"my-file-2\" \"my-file-3\"<\/pre>\n<h2>19. Restore files with tar<\/h2>\n<p>More important than performing regular backups is having them available when we need to recover important files. The following command will restore all files from the full-backup-Day-Month-Year.tar archive, which is an example backup of our home directory:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# tar xpf \/dev\/st0\/full-backup-Day-Month-Year.tar<\/pre>\n<p>The p option preserves permissions; file protection information will be remembered.<\/p>\n<p>Some of the above examples are depicted in the below image:<\/p>\n<figure id=\"attachment_787\" aria-describedby=\"caption-attachment-787\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_3.jpg\" rel=\"attachment wp-att-787\"><img decoding=\"async\" class=\"wp-image-787 size-full\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/02\/Tar_Example_3.jpg\" alt=\"Linux tar Examples: Tar Commands (3)\" width=\"860\" height=\"472\" \/><\/a><figcaption id=\"caption-attachment-787\" class=\"wp-caption-text\">Tar Commands (3)<\/figcaption><\/figure>\n<h2>20. Check the manual page for tar<\/h2>\n<p>You can always refer to the manual page for all available tar commands:<\/p>\n<pre class=\"brush:bash\">[root@chasiota \/]# man tar<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we feature a comprehensive Linux tar Examples. I am a real fan of learning Linux commands by examples and from my personal experience it will really help to see some Linux tar command examples. But first, a brief bit of background information. The name &#8220;tar&#8221; stands for &#8220;tape archive&#8221;. As that name &hellip;<\/p>\n","protected":false},"author":13,"featured_media":185,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-765","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux tar Examples - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.\" \/>\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.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux tar Examples - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-17T15:11:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-31T13:13:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nassos Hasiotis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nassos Hasiotis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\"},\"author\":{\"name\":\"Nassos Hasiotis\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/d9f94ea381f1a5d535cec1c751e2461b\"},\"headline\":\"Linux tar Examples\",\"datePublished\":\"2016-02-17T15:11:01+00:00\",\"dateModified\":\"2018-05-31T13:13:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\"},\"wordCount\":1085,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"articleSection\":[\"BASH\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\",\"name\":\"Linux tar Examples - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"datePublished\":\"2016-02-17T15:11:01+00:00\",\"dateModified\":\"2018-05-31T13:13:10+00:00\",\"description\":\"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Shell Scripting\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"BASH\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/bash\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Linux tar Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/d9f94ea381f1a5d535cec1c751e2461b\",\"name\":\"Nassos Hasiotis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5150c6873ee61791052d3faf00e804497c2cc4d613d5f6c67e00dc09ee794fdc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5150c6873ee61791052d3faf00e804497c2cc4d613d5f6c67e00dc09ee794fdc?s=96&d=mm&r=g\",\"caption\":\"Nassos Hasiotis\"},\"description\":\"Nassos has graduated from Computer Engineering and Informatics Department in the University of Patras. He also holds a Master degree in Communication and Network Systems from University of Athens. He has a 10-year work experience as a Java and C++ developer in the Telecommunication and IT industry participating in various projects. He currently works as a senior software developer in the IT sector where he is mainly involved with projects for the EU requiring extensive java skills.\",\"sameAs\":[\"http:\/\/www.systemcodegeeks.com\/\"],\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/nassos-hasiotis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux tar Examples - System Code Geeks - 2026","description":"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.","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.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/","og_locale":"en_US","og_type":"article","og_title":"Linux tar Examples - System Code Geeks - 2026","og_description":"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.","og_url":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_published_time":"2016-02-17T15:11:01+00:00","article_modified_time":"2018-05-31T13:13:10+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","type":"image\/jpeg"}],"author":"Nassos Hasiotis","twitter_card":"summary_large_image","twitter_creator":"@systemcodegeeks","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"Nassos Hasiotis","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/"},"author":{"name":"Nassos Hasiotis","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/d9f94ea381f1a5d535cec1c751e2461b"},"headline":"Linux tar Examples","datePublished":"2016-02-17T15:11:01+00:00","dateModified":"2018-05-31T13:13:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/"},"wordCount":1085,"commentCount":2,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","articleSection":["BASH"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/","url":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/","name":"Linux tar Examples - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","datePublished":"2016-02-17T15:11:01+00:00","dateModified":"2018-05-31T13:13:10+00:00","description":"Interested to learn more about Linux Tar? Then check out our detailed Linux tar Examples. In this example we will cover basic tar command using option \u2018cvf\u2019 to create a tar archive.","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-tar-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Shell Scripting","item":"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/"},{"@type":"ListItem","position":3,"name":"BASH","item":"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/bash\/"},{"@type":"ListItem","position":4,"name":"Linux tar Examples"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/d9f94ea381f1a5d535cec1c751e2461b","name":"Nassos Hasiotis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5150c6873ee61791052d3faf00e804497c2cc4d613d5f6c67e00dc09ee794fdc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5150c6873ee61791052d3faf00e804497c2cc4d613d5f6c67e00dc09ee794fdc?s=96&d=mm&r=g","caption":"Nassos Hasiotis"},"description":"Nassos has graduated from Computer Engineering and Informatics Department in the University of Patras. He also holds a Master degree in Communication and Network Systems from University of Athens. He has a 10-year work experience as a Java and C++ developer in the Telecommunication and IT industry participating in various projects. He currently works as a senior software developer in the IT sector where he is mainly involved with projects for the EU requiring extensive java skills.","sameAs":["http:\/\/www.systemcodegeeks.com\/"],"url":"https:\/\/www.systemcodegeeks.com\/author\/nassos-hasiotis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=765"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/765\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/185"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}