{"id":13254,"date":"2019-04-01T09:52:40","date_gmt":"2019-04-01T09:52:40","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13254"},"modified":"2019-04-01T09:52:40","modified_gmt":"2019-04-01T09:52:40","slug":"linux-zcat-command-examples-for-newbies","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/linux-zcat-command-examples-for-newbies\/","title":{"rendered":"Linux zcat Command Examples for Newbies"},"content":{"rendered":"<p>Normally, files compressed using\u00a0<strong>gzip<\/strong>\u00a0can be restored to their original form using\u00a0<strong>gzip -d<\/strong>\u00a0or\u00a0<strong>gunzip<\/strong>\u00a0commands. What if you want to view the contents of a compressed file without uncompressing it? For this purpose, you need the\u00a0<strong>zcat<\/strong>\u00a0command utility.<\/p>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/18-tar-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">18 tar Command Examples in Linux<\/a><\/p>\n<p><strong>Zcat<\/strong>\u00a0is a command line utility for viewing the contents of a compressed file without literally uncompressing it. It expands a compressed file to standard output allowing you to have a look at its contents. In addition, zcat is identical to running\u00a0<strong>gunzip -c<\/strong>\u00a0command. In this guide, we will explain zcat command examples for beginners.<\/p>\n<p><strong>1.<\/strong>\u00a0The first example shows how to view contents of a normal file using\u00a0<a href=\"https:\/\/www.tecmint.com\/13-basic-cat-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">cat command<\/a>, compress it using\u00a0<strong>gzip command<\/strong>\u00a0and view the contents of the zipped file using\u00a0<strong>zcat<\/strong>\u00a0as shown.<\/p>\n<pre>$ cat users.list \r\n$ gzip users.list\r\n$ zcat users.list.gz\r\n<\/pre>\n<div id=\"attachment_30272\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Compressed-File-Contents-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30272\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Compressed-File-Contents-in-Linux.png\" alt=\"View Compressed File Contents in Linux\" width=\"662\" height=\"382\" aria-describedby=\"caption-attachment-30272\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30272\" class=\"wp-caption-text\">View Compressed File Contents in Linux<\/p>\n<\/div>\n<p><strong>2.<\/strong>\u00a0To view multiple compressed files, use the following command with filenames as shown.<\/p>\n<pre>$ zcat users.list.gz apps.list.gz\r\n<\/pre>\n<div id=\"attachment_30273\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Multiple-Files-Content-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30273\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Multiple-Files-Content-in-Linux.png\" alt=\"View Multiple Compressed Files Content in Linux\" width=\"662\" height=\"268\" aria-describedby=\"caption-attachment-30273\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30273\" class=\"wp-caption-text\">View Multiple Compressed Files Content in Linux<\/p>\n<\/div>\n<p><strong>3.<\/strong>\u00a0To view contents of normal files use the\u00a0<code>-f<\/code>\u00a0flag, similar to\u00a0<a href=\"https:\/\/www.tecmint.com\/13-basic-cat-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">cat command<\/a>, for example.<\/p>\n<pre>$ zcat -f users.list\r\n<\/pre>\n<div id=\"attachment_30274\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Linux-File-Contents.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30274\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Linux-File-Contents.png\" alt=\"View Linux File Contents\" width=\"662\" height=\"192\" aria-describedby=\"caption-attachment-30274\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30274\" class=\"wp-caption-text\">View Linux File Contents<\/p>\n<\/div>\n<p><strong>4.<\/strong>\u00a0To enable pagination, you can use the\u00a0<strong>more<\/strong>\u00a0and\u00a0<strong>less<\/strong>\u00a0commands as shown (Also read:\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-more-command-and-less-command-examples\/\" target=\"_blank\" rel=\"noopener\">Why \u2018less\u2019 is Faster Than \u2018more\u2019 Command in Linux<\/a>).<\/p>\n<pre>$ zcat users.list.gz | more\r\n$ zcat users.list.gz | less\r\n<\/pre>\n<p><strong>5.<\/strong>\u00a0To get the properties (compressed size, uncompressed size, ratio \u2013 compression ratio (0.0% if unknown), uncompressed_name (name of the uncompressed file) of a compressed file, use the\u00a0<code>-l<\/code>\u00a0flag.<\/p>\n<pre>$ zcat -l users.list.gz  \r\n<\/pre>\n<div id=\"attachment_30275\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Compressed-File-Properties-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30275\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/08\/View-Compressed-File-Properties-in-Linux.png\" alt=\"View Compressed File Properties in Linux\" width=\"662\" height=\"154\" aria-describedby=\"caption-attachment-30275\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30275\" class=\"wp-caption-text\">View Compressed File Properties in Linux<\/p>\n<\/div>\n<p><strong>6.<\/strong>\u00a0To suppress all warnings, use the\u00a0<code>-q<\/code>\u00a0flag as shown.<\/p>\n<pre>$ zcat -q users.list.gz\r\n<\/pre>\n<p>For more information, see the\u00a0<strong>zcat<\/strong>\u00a0man page.<\/p>\n<pre>$ man zcat\r\n<\/pre>\n<p>You might also like to read these following related articles.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/cat-command-output-with-syntax-highlighting-or-color\/\" target=\"_blank\" rel=\"noopener\">ccat \u2013 Show \u2018cat Command\u2019 Output with Syntax Highlighting or Colorizing<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/learn-linux-cat-command-and-tac-command\/\" target=\"_blank\" rel=\"noopener\">How to Use \u2018cat\u2019 and \u2018tac\u2019 Commands with Examples in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/view-contents-of-file-in-linux\/\" target=\"_blank\" rel=\"noopener\">Manage Files Effectively using head, tail and cat Commands in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/backup-or-clone-linux-partitions-using-cat-command\/\" target=\"_blank\" rel=\"noopener\">How to Backup or Clone Linux Partitions Using \u2018cat\u2019 Command<\/a><\/li>\n<\/ol>\n<p>That\u2019s all! In this short article, we\u2019ve explained\u00a0<strong>zcat command<\/strong>\u00a0examples for beginners. Share your thoughts with us in the comments section below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/linux-zcat-command-examples\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Normally, files compressed using\u00a0gzip\u00a0can be restored to their original form using\u00a0gzip -d\u00a0or\u00a0gunzip\u00a0commands. What if you want to view the contents of a compressed file without uncompressing it? For this purpose, you need the\u00a0zcat\u00a0command utility. Read Also:\u00a018 tar Command Examples in Linux Zcat\u00a0is a command line utility for viewing the contents of a compressed file without &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/linux-zcat-command-examples-for-newbies\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux zcat Command Examples for Newbies&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13254","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13254"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13254\/revisions"}],"predecessor-version":[{"id":13255,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13254\/revisions\/13255"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}