I have vps that is having problems and needs the files to be deleted from its tmp/ directory. The problem is, that the user has filled the tmp/ directory with so many files the list of files alone (i.e. the size of the folder not counting the actual size of the files) is about a Gig. Attempting to delete the contents of this folder via 'rm -rf /tmp/*' or anything similar yields no effect since the size is so massive that memory is quickly exhausted. I have no idea what is in this folder, so we can't delete anything until we see what is in there. The 'find' command, 'ls' command, 'vim' command, 'rm' command, etc. all run out of memory attempting to read this folder's contents. Does anyone know of a way to read only part of the folder's contents without exhausting ram? (for instance 'ls | grep something' would do not good as the whole folder would still be read)
closed as off topic by Chris S♦ Aug 23 '12 at 18:02
Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.