{"id":78,"date":"2008-09-17T00:29:00","date_gmt":"2008-09-17T00:29:00","guid":{"rendered":"http:\/\/wp.neependra.net\/?p=78"},"modified":"2008-09-17T00:29:00","modified_gmt":"2008-09-17T00:29:00","slug":"how-do-log-every-thing-printed-on-the-terminal","status":"publish","type":"post","link":"https:\/\/neependra.net\/index.php\/2008\/09\/17\/how-do-log-every-thing-printed-on-the-terminal\/","title":{"rendered":"How do log every thing printed on the terminal"},"content":{"rendered":"<p>Sometimes we just keep working on a terminal and get lost what all we did.<br \/>Isn&#8217;t it good if we can get some kind of logs which can give us all steps we followed.<\/p>\n<p>First thing which comes in mind is the &#8220;history&#8221; command, but that will not give the standard outputs which we got after running the commands.<\/p>\n<p>So, here is the solution.Use a command called &#8220;script&#8221;.<\/p>\n<p>e.g.<\/p>\n<p><span style=\"font-style: italic;\">$ script standard_out.txt<\/span><br \/><span style=\"font-style: italic;\">Script started, file is standard_out.txt<\/span><br \/><span style=\"font-style: italic;\">$ date<\/span><br \/><span style=\"font-style: italic;\">Mon Sep  8 07:57:20 IST 2008<\/span><br \/><span style=\"font-style: italic;\">$ asdf<\/span><br \/><span style=\"font-style: italic;\">bash: asdf: command not found<\/span><br \/><span style=\"font-style: italic;\">$ exit<\/span><br \/><span style=\"font-style: italic;\">Script done, file is standard_out.txt<\/span><br \/><span style=\"font-style: italic;\"><\/span><br \/><span style=\"font-style: italic;\">To exit you need to press &#8220;ctrl+D&#8221;.<\/span><\/p>\n<p>Now lets check the content of &#8220;standard_out.txt&#8221; file.<span style=\"font-style: italic;\"><\/p>\n<p>$ cat standard_out.txt<br \/>Script started on Mon 08 Sep 2008 07:57:10 AM IST<br \/>$ date<br \/>Mon Sep  8 07:57:20 IST 2008<br \/>$ asdf<br \/>bash: asdf: command not found<br \/>$ exit<br \/>Script done on Mon 08 Sep 2008 07:57:38 AM IST<\/p>\n<p>For more information look at the man page of  &#8221;script&#8221;&#8216;.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we just keep working on a terminal and get lost what all we did.Isn&#8217;t it good if we can get some kind of logs which can give us all steps we followed. First thing which comes in mind is the &#8220;history&#8221; command, but that will not give the standard outputs which we got after &#8230; <a title=\"How do log every thing printed on the terminal\" class=\"read-more\" href=\"https:\/\/neependra.net\/index.php\/2008\/09\/17\/how-do-log-every-thing-printed-on-the-terminal\/\" aria-label=\"Read more about How do log every thing printed on the terminal\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[48],"tags":[134],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-tips-and-tricks"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":0,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}