Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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)

share|improve this question

closed as off topic by Chris S Aug 23 '12 at 18:02

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. 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 reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
see unix.stackexchange.com/questions/37329/… –  smcg Aug 23 '12 at 17:54
    
Sorry about the close reason, I can't close as a dupe of a question on another site. The above link provided by smcg provides a few different ways to accomplish what you're looking for. –  Chris S Aug 23 '12 at 18:02

Browse other questions tagged or ask your own question.