{"id":86,"date":"2021-10-07T03:24:00","date_gmt":"2021-10-07T03:24:00","guid":{"rendered":"https:\/\/bestdedicatedhosting.in\/blog\/?p=86"},"modified":"2021-11-02T13:09:36","modified_gmt":"2021-11-02T13:09:36","slug":"linux-rev-command","status":"publish","type":"post","link":"https:\/\/bestdedicatedhosting.in\/blog\/linux-rev-command\/","title":{"rendered":"Linux rev Command"},"content":{"rendered":"\n<p><strong>Linux rev command<\/strong><\/p>\n\n\n\n<p>The rev command in Linux reverses lines of text characterwise.<\/p>\n\n\n\n<p>Following is its syntax: rev [option] [file&#8230;]<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td>rev [option] [file&#8230;]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>And here\u2019s what the man page says about it: The rev utility copies the specified files to standard output, revers? ing the order of characters in every line. If no files are specified, standard input is read.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123<\/td><td>The rev utility copies the specified files to standard output, revers?ing the order of characters in every line. If no files are specified,standard input is read.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Following are some examples that should give you a better idea on how the rev command works.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">To use rev command<\/h5>\n\n\n\n<p>Simple, just execute \u2018rev\u2019 sans any option. rev<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td>rev<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>When you execute the tool in such a way, it will wait for you to enter some input. You can enter a word or a line, and as soon as you\u2019re done, press the Enter key, and you\u2019ll see reversed text in the output.<\/p>\n\n\n\n<p>For example, I entered the following input: hello world<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td>hello world<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>And got the following output: dlrow olleh<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td>dlrow olleh<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">rev command works with files<\/h5>\n\n\n\n<p>This is also pretty straightforward. Just pass the name of the file as input, and you\u2019ll see reversed contents in output.<\/p>\n\n\n\n<p>So you can see that the lines in file \u2018test.txt\u2019 got reversed in the output.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">To see help and version information<\/h5>\n\n\n\n<p>Use the -V and -h command line options for this. rev -V rev -h<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12<\/td><td>rev -Vrev -h<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Here\u2019s the output these commands produced on my system<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">To reverse line wise, instead of character wise<\/h5>\n\n\n\n<p>While the rev command works character wise on lines of text,there\u2019s another command \u2013 dubbed tac \u2013 that reverses the information lines wise. You can learn more about tac by heading here.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Conclusion<\/h5>\n\n\n\n<p>The rev command doesn\u2019t have a steep learning curve. In fact, it doesn\u2019t really offer many command line options.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux rev command The rev command in Linux reverses lines of text characterwise. Following is its syntax: rev [option] [file&#8230;] 1 rev [option] [file&#8230;] And here\u2019s what the man page says about it: The rev utility copies the specified files to standard output, revers? ing the order of characters in every line. If no files [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[4],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-linux"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":1,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":87,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions\/87"}],"wp:attachment":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}