{"id":608,"date":"2021-11-11T18:43:29","date_gmt":"2021-11-11T23:43:29","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=608"},"modified":"2021-11-11T18:44:42","modified_gmt":"2021-11-11T23:44:42","slug":"linux-redirection","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/linux-redirection\/","title":{"rendered":"Linux Redirection"},"content":{"rendered":"\n<p>Linux processes generally take input from standard input (keyboard), write output to standard out (screen) and may write to standard error if there are any error message which need to be displayed. Among the various powerful functions of Linux systems is the ability to redirect both input and output of commands.<\/p>\n\n\n\n<p>The &gt; symbol redirects output of a command. For example, cal command prints the calendar to screen. Using &gt; we can save this calendar into a file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cal > calendar.txt\ncat calendar.txt<\/code><\/pre>\n\n\n\n<p>If the file calendar.txt already exists, its contents would be replaced. If you wish to append content to an existing file, use the &gt;&gt; symbol instead.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls >> calendar.txt\ncat calendar.txt<\/code><\/pre>\n\n\n\n<p>You can also use cat to concatenate files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cal 2017 &gt; 2017\ncal 2018 &gt; 2018\ncat 2017 2018 &gt; calendar.txt<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux processes generally take input from standard input (keyboard), write output to standard out (screen) and may write to standard error if there are any error message which need to be displayed. Among the various powerful functions of Linux systems is the ability to redirect both input and output of commands. The &gt; symbol redirects [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[35],"class_list":["post-608","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/608","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=608"}],"version-history":[{"count":2,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/608\/revisions"}],"predecessor-version":[{"id":610,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/608\/revisions\/610"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}