{"id":808,"date":"2014-08-11T08:54:32","date_gmt":"2014-08-11T08:54:32","guid":{"rendered":"https:\/\/cpanelplesk.com\/wp62\/?p=808"},"modified":"2021-02-17T09:21:11","modified_gmt":"2021-02-17T09:21:11","slug":"deleting-old-files-in-tmp-on-cpanel","status":"publish","type":"post","link":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/","title":{"rendered":"Deleting x days old files in tmp on cPanel server"},"content":{"rendered":"<p>Time to time we receive a complaint from managed VPS clients that they are not able to create session, they usually get an error some thing like<\/p>\n<div class=\"msg Nth\">\n<div class=\"notice-error-sh\">\n<pre class=\"lang:default decode:true\">PHP Warning: Unknown:\r\nopen(\/tmp\/sess_8974c0acd95c8d7ae09aa9222bb1acab, O_RDWR) failed: No space<\/pre>\n<\/div>\n<div class=\"space1\"><\/div>\n<p>Usually you can do the same old thing i.e. remove old files from \/tmp. Usually deleting files older than 1 day is totally safe. Here is the command to do that.<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true\">find * -mtime +1 -exec rm {} \\;<\/pre>\n<\/div>\n<p>find command finds all files older than 1 day and pass it to rm which deletes them. Note there is space \u00a0before and after {}. However if number of files in tmp are too much you will get this error.<br \/>\n<span style=\"color: #000000;\">\/usr\/bin\/find: Argument list too long<\/span><br \/>\nTo tackle argument too long issue, use it with &#8220;find .&#8221; instead of &#8220;find *&#8221;<br \/>\nThe following commands worked good for me.<\/p>\n<div class=\"command-sh\">\n<pre>cd \/tmp\r\nfind . -mtime +1 | xargs rm -Rf`\r\n<\/pre>\n<\/div>\n<p>and<\/p>\n<div class=\"command-sh\">\n<pre>find . -mtime +1 -delete\r\n<\/pre>\n<\/div>\n<p>if you receive folder errors, add a file filter. <strong>The final command that you should use to delete x days old files in \/tmp\u00a0folder is\u00a0<\/strong><\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true\">find \/tmp\/. -type f -mtime +1 -delete<\/pre>\n<\/div>\n<p>update:<br \/>\nTo\u00a0remove files by access time use: atime<br \/>\nTo remove files by status change (like name or attributes): ctime<br \/>\nTo remove files by content modify time use (as used in this article): mtime<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time to time we receive a complaint from managed VPS clients that they are not able to create session, they usually get an error some thing like PHP Warning: Unknown: open(\/tmp\/sess_8974c0acd95c8d7ae09aa9222bb1acab, O_RDWR) failed: No space Usually you can do the same old thing i.e. remove old files from \/tmp. Usually deleting files older than 1 [&#8230;]<\/p>\n<p><a class=\"understrap-read-more-link\" href=\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-808","post","type-post","status-publish","format-standard","hentry","category-cpanel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Deleting x days old files in tmp on cPanel server - cPanel Plesk<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Deleting x days old files in tmp on cPanel server - cPanel Plesk\" \/>\n<meta name=\"twitter:description\" content=\"Time to time we receive a complaint from managed VPS clients that they are not able to create session, they usually get an error some thing like PHP Warning: Unknown: open(\/tmp\/sess_8974c0acd95c8d7ae09aa9222bb1acab, O_RDWR) failed: No space Usually you can do the same old thing i.e. remove old files from \/tmp. Usually deleting files older than 1 [...]Continue Reading...\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Farooq Omer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\"},\"author\":{\"name\":\"Farooq Omer\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"headline\":\"Deleting x days old files in tmp on cPanel server\",\"datePublished\":\"2014-08-11T08:54:32+00:00\",\"dateModified\":\"2021-02-17T09:21:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\"},\"wordCount\":194,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"articleSection\":[\"Cpanel\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\",\"name\":\"Deleting x days old files in tmp on cPanel server - cPanel Plesk\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\"},\"datePublished\":\"2014-08-11T08:54:32+00:00\",\"dateModified\":\"2021-02-17T09:21:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cpanelplesk.com\/wp62\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deleting x days old files in tmp on cPanel server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/\",\"name\":\"cPanel Plesk\",\"description\":\"Blog on famous hosting control panels\",\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\",\"name\":\"Farooq Omer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"width\":300,\"height\":44,\"caption\":\"Farooq Omer\"},\"logo\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/cpanelplesk.com\/wp62\/author\/fokado\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deleting x days old files in tmp on cPanel server - cPanel Plesk","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:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/","twitter_card":"summary_large_image","twitter_title":"Deleting x days old files in tmp on cPanel server - cPanel Plesk","twitter_description":"Time to time we receive a complaint from managed VPS clients that they are not able to create session, they usually get an error some thing like PHP Warning: Unknown: open(\/tmp\/sess_8974c0acd95c8d7ae09aa9222bb1acab, O_RDWR) failed: No space Usually you can do the same old thing i.e. remove old files from \/tmp. Usually deleting files older than 1 [...]Continue Reading...","twitter_misc":{"Written by":"Farooq Omer","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#article","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/"},"author":{"name":"Farooq Omer","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"headline":"Deleting x days old files in tmp on cPanel server","datePublished":"2014-08-11T08:54:32+00:00","dateModified":"2021-02-17T09:21:11+00:00","mainEntityOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/"},"wordCount":194,"commentCount":0,"publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"articleSection":["Cpanel"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/","url":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/","name":"Deleting x days old files in tmp on cPanel server - cPanel Plesk","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#website"},"datePublished":"2014-08-11T08:54:32+00:00","dateModified":"2021-02-17T09:21:11+00:00","breadcrumb":{"@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cpanelplesk.com\/wp62\/deleting-old-files-in-tmp-on-cpanel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cpanelplesk.com\/wp62\/"},{"@type":"ListItem","position":2,"name":"Deleting x days old files in tmp on cPanel server"}]},{"@type":"WebSite","@id":"https:\/\/cpanelplesk.com\/wp62\/#website","url":"https:\/\/cpanelplesk.com\/wp62\/","name":"cPanel Plesk","description":"Blog on famous hosting control panels","publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13","name":"Farooq Omer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","width":300,"height":44,"caption":"Farooq Omer"},"logo":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/"},"url":"https:\/\/cpanelplesk.com\/wp62\/author\/fokado\/"}]}},"_links":{"self":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/comments?post=808"}],"version-history":[{"count":0,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/808\/revisions"}],"wp:attachment":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/media?parent=808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/categories?post=808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/tags?post=808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}