{"id":1253,"date":"2012-12-04T06:05:14","date_gmt":"2012-12-04T06:05:14","guid":{"rendered":"http:\/\/www.oratraining.com\/blog\/?p=1253"},"modified":"2013-05-20T05:18:15","modified_gmt":"2013-05-20T05:18:15","slug":"how-to-delete-large-files-in-solarislinux-without-restarting-service","status":"publish","type":"post","link":"https:\/\/www.oratraining.com\/blog\/2012\/12\/how-to-delete-large-files-in-solarislinux-without-restarting-service\/","title":{"rendered":"How to delete\/purge large log files in Solaris\/Linux without restarting service"},"content":{"rendered":"<p>In Windows we cannot delete log files which are still being used by a service, for example Oracle related services (though there are many third-party tools which can do but we are talking in general).<\/p>\n<p>In Solaris\/Linux, we can rename the files but sometimes you will see that the new log entries are coming into the same old file which was renamed.<\/p>\n<p>&nbsp;<\/p>\n<p>There is a simple way to clear the contents of a log file which is still being written by another service.<\/p>\n<p>Take a backup of existing file if required for later reference. (Optional)<\/p>\n<blockquote><p><span style=\"color: #ff0000;\"><strong>cp -p filename filename.bkp<\/strong><\/span><\/p><\/blockquote>\n<p>Now empty the contents of the file without deleting or changing the inode.<\/p>\n<blockquote><p><span style=\"color: #ff0000;\"><strong>&gt; filename<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>(simply enter greater than sign followed by file name on command prompt)<\/strong><\/span><\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>You will see that the file size has become zero now and new logs will continue to fill this same file only.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Windows we cannot delete log files which are still being used by a service, for example Oracle related services (though there are many third-party tools which can do but we are talking in general). In Solaris\/Linux, we can rename the files but sometimes you will see that the new log entries are coming into [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[26,3,4,7,18,19],"tags":[58,96,166,168,127,167,141],"class_list":["post-1253","post","type-post","status-publish","format-standard","hentry","category-applications-performance-tuning","category-linuxunixsolaris","category-oracle","category-oracle-applications-issues","category-shell-scripting","category-unix-administration-linuxunixsolaris","tag-delete","tag-linux","tag-log-files","tag-remove","tag-solaris","tag-truncate","tag-unix"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/posts\/1253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/comments?post=1253"}],"version-history":[{"count":0,"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/posts\/1253\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/media?parent=1253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/categories?post=1253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oratraining.com\/blog\/wp-json\/wp\/v2\/tags?post=1253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}