{"id":7211,"date":"2018-11-08T16:47:30","date_gmt":"2018-11-08T13:47:30","guid":{"rendered":"https:\/\/www.howtoforge.com\/linux-zmore-command\/"},"modified":"2018-11-08T16:47:30","modified_gmt":"2018-11-08T13:47:30","slug":"linux-zmore-command-tutorial-for-beginners-5-examples","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linux-zmore-command-tutorial-for-beginners-5-examples\/","title":{"rendered":"Linux zmore Command Tutorial for Beginners (5 Examples)"},"content":{"rendered":"<p>Sometimes, you may want to view the contents of a compressed file without uncompressing it first. Well, you&#8217;ll be glad to know Linux offers a command line utility that lets you do this. In this tutorial, we will discuss the basics of the <strong>zmore<\/strong> command using some easy to understand examples.<\/p>\n<p>But before we do that, it&#8217;s worth mentioning that all examples here have been tested on an Ubuntu 18.04 LTS machine.<\/p>\n<h2 id=\"linux-zmore-command\">Linux zmore command<\/h2>\n<p>The zmore command in Linux is basically a file perusal filter for crt viewing of compressed text. Following is its syntax:<\/p>\n<p class=\"command\">zmore [ name &#8230;\u00a0 ]<\/p>\n<p>And here&#8217;s how the tool&#8217;s man page defines it:<\/p>\n<pre readability=\"10\">Zmore\u00a0 is\u00a0 a\u00a0 filter\u00a0 which\u00a0 allows\u00a0 examination of compressed or plain text files one screenful <br\/>at a time on a soft-copy terminal. Zmore works on files compressed with compress, pack or gzip, <br\/>and also on uncompressed files.\u00a0 If a file does not exist, zmore looks for a file of the same name <br\/>with the addition of a .gz, .z or .Z suffix.<p>Zmore\u00a0 normally\u00a0 pauses\u00a0 after\u00a0 each\u00a0 screenful,\u00a0 printing --More-- at the bottom of the screen.\u00a0 <br\/>If the user then types a carriage return, one more line is displayed. If the user hits a space, <br\/>another screenful is displayed.\u00a0 Other possibilities are\u00a0 enumerated later.<\/p><\/pre>\n<p>Following are some Q&amp;A styled examples that should give you a better idea on how the zmore command works.<\/p>\n<h2 id=\"q-how-to-use-zmore\">Q1. How to use zmore?<\/h2>\n<p>Suppose you have a compressed file &#8211; test.html.gz in my case &#8211; whose contents you want to quickly view one page or line at a time on the terminal screen. Here&#8217;s how you can use zmore to do this:<\/p>\n<p class=\"command\">zmore test.html.gz<\/p>\n<p>The aforementioned command produced the following output:<\/p>\n<p><a class=\"fancybox\" id=\"img-zmore-basic1\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/zmore-basic1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples.png\" alt=\"How to use zmore\" width=\"500\" height=\"436\" title=\"\"><\/a><\/p>\n<p>So you can see the first page of the file was produced in the output. You can press the enter key to scroll and see and the rest of the file one line at a time. To quit press &#8216;q&#8217;.<\/p>\n<h2 id=\"q-how-to-make-zmore-scroll-file-contents-multiple-lines-at-a-time\">Q2. How to make zmore scroll file contents multiple lines at a time?<\/h2>\n<p>Of course, pressing the enter key multiple times is a way, but it&#8217;s definitely not an elegant way out. A better way is to press the spacebar key, which lets you scroll one screen at a time.<\/p>\n<p>However, in case you want to scroll the content multiple lines at a time, just press &#8216;i&#8217; followed by a number that represents the number of lines to be scrolled.<\/p>\n<pre>i&lt;space&gt;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display i more lines, (or another screenful if no argument is given)<\/pre>\n<p>Alternatively, you can also press Ctrl+D to make zmore display 11 more lines.<\/p>\n<pre>^D\u00a0\u00a0\u00a0\u00a0 display 11 more lines (a ``scroll'').\u00a0 If i is given, then the scroll size is set to i.<\/pre>\n<h2 id=\"q-how-to-make-zmore-skip-lines-or-screens\">Q3. How to make zmore skip lines or screens?<\/h2>\n<p>The zmore command offers two options for this:<\/p>\n<pre readability=\"5\">is - skip i lines and print a screenful of lines<p>if - skip i screenfuls and print a screenful of lines<\/p><\/pre>\n<h2 id=\"q-how-to-make-zmore-display-the-current-line-number\">Q4. How to make zmore display the current line number?<\/h2>\n<p>At any point in time while using zmore, if you want to know the current line number, just press =.<\/p>\n<p>For example, in my case, zmore displayed 35 at the bottom of the screen when I pressed =.<\/p>\n<p><a class=\"fancybox\" id=\"img-zmore-line-number\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/zmore-line-number.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples-1.png\" alt=\"How to make zmore display the current line number\" width=\"500\" height=\"403\" title=\"\"><\/a><\/p>\n<h2 id=\"q-how-zmore-determines-terminal-characteristics\">Q5. How zmore determines terminal characteristics?<\/h2>\n<p>This is done through the file \/etc\/termcap. The man page explains it in detail:<\/p>\n<pre>Zmore looks in the file \/etc\/termcap to determine terminal characteristics, and to determine the <br\/>default window size. On a terminal capable of displaying 24 lines, the default window size is 22 <br\/>lines. To use a pager other than the default more, set\u00a0 environment variable PAGER to the name of <br\/>the desired program, such as less.<\/pre>\n<p>To change window size, use the &#8216;iz&#8217; method. Here&#8217;s how it&#8217;s explained:<\/p>\n<pre>iz\u00a0 -\u00a0\u00a0 same as typing a space except that i, if present, becomes the new window size.<\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>The zmore command is handy for those who deal a lot with compressed files. Learning curve for the tool isn&#8217;t steep. We&#8217;ve already discussed some useful command line options zmore offers. To learn more, head to the tool&#8217;s <a href=\"https:\/\/linux.die.net\/man\/1\/zmore\" target=\"_blank\" rel=\"noopener noreferrer\">man page<\/a>.<\/p>\n<div class=\"authorbox\" readability=\"15\">\n<img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples.jpg\" alt=\"Himanshu Arora\" title=\"\"> <\/p>\n<p><strong>About Himanshu Arora<\/strong><\/p>\n<p>Himanshu Arora has been working on Linux since 2007. He carries professional experience in system level programming, networking protocols, and command line. In addition to HowtoForge, Himanshu&#8217;s work has also been featured in some of world&#8217;s other leading publications including Computerworld, IBM DeveloperWorks, and Linux Journal.<\/p>\n<\/div>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Flinux-zmore-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples-2.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-zmore-command%2F&amp;text=Linux+zmore+Command+Tutorial+for+Beginners+%285+Examples%29&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples-3.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples-4.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-zmore-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/11\/linux-zmore-command-tutorial-for-beginners-5-examples-5.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you may want to view the contents of a compressed file without uncompressing it first. Well, you&#8217;ll be glad to know Linux offers a command line utility that lets you do this. In this tutorial, we will discuss the basics of the zmore command using some easy to understand examples. But before we do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-7211","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/7211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=7211"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/7211\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=7211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=7211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=7211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}