{"id":2599,"date":"2019-06-15T12:27:16","date_gmt":"2019-06-15T06:57:16","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=2599"},"modified":"2019-06-16T14:25:39","modified_gmt":"2019-06-16T08:55:39","slug":"how-to-delete-large-files-in-linux","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/","title":{"rendered":"How to delete large files in Linux"},"content":{"rendered":"\n<p>In general, we use rm command to delete files, shred command for secure deletion. But for Large files like 100s of GB files deletion can not be that easy as it uses more RAM and CPU while the process is running, which may increase the load on server and slow it down.<\/p>\n\n\n\n<p>We can use <strong>ionice<\/strong> to define  I\/O scheduling class and priority for another process. <\/p>\n\n\n\n<p>When we use ionice with command rm, it will run this command with given arguments.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># man ionice<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">OPTIONS\n  -c, --class class\n\n              Specify the name or number of the scheduling class to use; 0 for none, 1 for realtime, 2 for best-effort, 3 for idle. \n\n  -n, --classdata level\n          Specify the scheduling class data.  This only has an effect if the class accepts an argument.  For  realtime  and  best-\n          effort, 0-7 are valid data (priority levels).\n\n   -p, --pid PID...\n          Specify the process IDs of running processes for which to get or set the scheduling parameters.\n\n   -t, --ignore\n          Ignore  failure to set the requested priority.  If command was specified, run it even in case it was not possible to set\n          the desired scheduling priority, which can happen due to insufficient privileges or an old kernel version.\n\n   -h, --help\n          Display help and exit.\n\n   -V, --version\n          Display version information and exit.<\/pre>\n\n\n\n<p>To specify the name or number of the scheduling class to use (<strong>0<\/strong>&nbsp;for none,&nbsp;<strong>1<\/strong>&nbsp;for real time,&nbsp;<strong>2<\/strong>&nbsp;for best-effort,&nbsp;<strong>3<\/strong>&nbsp;for idle) the command below.<\/p>\n\n\n\n<p>This means that&nbsp;<strong>rm<\/strong>&nbsp;will belong to idle I\/O class and only uses I\/O when any other process does not need it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># ionice -c 3 rm \/var\/logs\/maillog\n# ionice -c 3 rm -rf \/var\/log\/apache\/access_logs<\/pre>\n\n\n\n<p> If there won\u2019t be much idle time on the system, then we may want to use scheduling class and set a low priority like this: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># ionice -c 2 -n 6 rm \/var\/logs\/maillog\n# ionice -c 2 -n 6 rm -rf \/var\/log\/apache\/access_logs<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In general, we use rm command to delete files, shred command for secure deletion. But for Large files like 100s of GB files deletion can not be that easy as it uses more RAM and CPU while the process is running, which may increase the load on server and slow it down. We can use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[34],"tags":[167,112],"class_list":["post-2599","post","type-post","status-publish","format-standard","hentry","category-linux","tag-delete-huge-files","tag-linux"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to delete large files in Linux | 24x7serversupport Blog<\/title>\n<meta name=\"description\" content=\"How to delete large files in Linux\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to delete large files in Linux | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"How to delete large files in Linux\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-15T06:57:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-16T08:55:39+00:00\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/\",\"name\":\"How to delete large files in Linux | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"datePublished\":\"2019-06-15T06:57:16+00:00\",\"dateModified\":\"2019-06-16T08:55:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"description\":\"How to delete large files in Linux\",\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to delete large files in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to delete large files in Linux | 24x7serversupport Blog","description":"How to delete large files in Linux","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to delete large files in Linux | 24x7serversupport Blog","og_description":"How to delete large files in Linux","og_url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/","og_site_name":"24x7serversupport Blog","article_published_time":"2019-06-15T06:57:16+00:00","article_modified_time":"2019-06-16T08:55:39+00:00","author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/","url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/","name":"How to delete large files in Linux | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"datePublished":"2019-06-15T06:57:16+00:00","dateModified":"2019-06-16T08:55:39+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"description":"How to delete large files in Linux","breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-delete-large-files-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to delete large files in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=2599"}],"version-history":[{"count":2,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2599\/revisions"}],"predecessor-version":[{"id":2602,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2599\/revisions\/2602"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=2599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=2599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=2599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}