Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
/proc folder cleaning

Hi All,


From the root, we have a /proc folder where we have over 210 numbered folders. These I think are processes that have been carried out over a period of time. Are these called virtual folders.....


Is there anyway of house keeping these items to be deleted, removed on a daily basis.






The /proc folder doesn't take up any space on your system, it is merely a representation of your kernel/system state. There is nothing to clean-up in there, further more there is no reason to clean-up.


Those 210 numbered folders will represent the processes that are running/sleeping on the system, if they are left behind then they are still in the kernel's memory, what you want to do is use ps (et al) to find them and remove them will kill (etc). You cannot manually remove them.


For instance:

# ls -d /proc/[0-9]*
/proc/1      /proc/14673  /proc/2290   /proc/4370  /proc/5166  /proc/5771
/proc/11640  /proc/14727  /proc/2291   /proc/4828  /proc/5167  /proc/6627
/proc/11651  /proc/15591  /proc/2454   /proc/4909  /proc/5175  /proc/6630
/proc/12029  /proc/15613  /proc/24801  /proc/4919  /proc/5176  /proc/736
/proc/122    /proc/16037  /proc/3      /proc/4927  /proc/5200  /proc/740
/proc/123    /proc/16040  /proc/30     /proc/4928  /proc/5208  /proc/7771
/proc/14100  /proc/16049  /proc/31     /proc/4938  /proc/5228  /proc/8028
/proc/14517  /proc/16052  /proc/3652   /proc/4943  /proc/5563  /proc/99
/proc/14526  /proc/1938   /proc/3653   /proc/4979  /proc/5626
/proc/14536  /proc/1939   /proc/3664   /proc/5     /proc/5685
/proc/14559  /proc/2      /proc/4      /proc/5140  /proc/5755
/proc/14672  /proc/20350  /proc/4369   /proc/5147  /proc/5768


So if I want to ensure that all of those represent a running process I can do that with something like (careful with your quotes and this is for bash shells):

# for proc in `ls -d /proc/[0-9]*`; do ps ${proc:6}>/dev/null || echo "Missing: $proc"; done
Missing: /proc/16568


Now that process isn't actually to be worried about because as soon as it finished my "for ..... done" test, that 16568 was gone (obviously it was used during the test).


Therefore none of my proc folders are incorrect.


I hope this gives you an idea about what these folders are, the kernel will clean them up when the process is complete.




Forum Jump:

Users browsing this thread: 1 Guest(s)