{"id":341,"date":"2012-04-25T11:49:50","date_gmt":"2012-04-25T11:49:50","guid":{"rendered":"http:\/\/www.plugged.in\/?p=341"},"modified":"2012-04-25T11:49:50","modified_gmt":"2012-04-25T11:49:50","slug":"how-to-clear-contents-of-a-file","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/how-to-clear-contents-of-a-file\/","title":{"rendered":"How to clear contents of a file ?"},"content":{"rendered":"<p>If you want to clear contents of a file in unix, you could just delete the file and recreate it.<\/p>\n<p>But there are much more simple alternatives.<\/p>\n<p><strong>You can use echo method.<\/strong><\/p>\n<p>To empty a file just enter the command below. I use my php_error.log file for example.<\/p>\n<blockquote><p>echo -n &gt; \/home\/base\/logs\/php_error.log<\/p><\/blockquote>\n<p>That&#8217;s it. Your file is empty now.<\/p>\n<p><strong>You can use VI Editor.<\/strong><\/p>\n<p>First, open the file that you want to empty with vi editor.\u00a0I use my php_error.log file for example.<\/p>\n<blockquote>\n<div>vi \/home\/base\/logs\/php_error.log<\/div>\n<\/blockquote>\n<p>On the first line, type<strong> &#8220;dG&#8221;<\/strong> without quotes. It means delete globally on VI Editor.<\/p>\n<p>Then quit with &#8220;:wq&#8221; without quotes of course \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to clear contents of a file in unix, you could just delete the file and recreate it. But there are much more simple alternatives. You can use echo method. To empty a file just enter the command below. I use my php_error.log file for example. echo -n &gt; \/home\/base\/logs\/php_error.log That&#8217;s it. Your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[372],"tags":[],"yst_prominent_words":[1873,1870,338,1869,1868,1872,605,1866,1871,1867,1864,1874,1396,1865],"class_list":["post-341","post","type-post","status-publish","format-standard","hentry","category-linux_help"],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"ckaraca","author_link":"https:\/\/www.veriteknik.net.tr\/en\/author\/ckaraca\/"},"uagb_comment_info":0,"uagb_excerpt":"If you want to clear contents of a file in unix, you could just delete the file and recreate it. But there are much more simple alternatives. You can use echo method. To empty a file just enter the command below. I use my php_error.log file for example. echo -n &gt; \/home\/base\/logs\/php_error.log That&#8217;s it. Your&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/comments?post=341"}],"version-history":[{"count":0,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/341\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=341"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}