Posts

Showing posts from December, 2006

rm and the 'Argument list too long'

you wanted to delete all the files in a directory that begins with the word 'temp' bala bala [prabhat@my-site]# rm temp* bash: /bin/rm: Argument list too long ERROR! This happens when you are trying to delete too many files in a directory at the same time - it seems rm has limits .... To solve the problem: Use 'find' to pipe all the matching files to 'rm', one at a time. [prabhat@my-site]# find . -name 'temp*' | xargs rm or [prabhat@my-site]# find . -name 'temp*' - print0 | xargs -0 rm -f

Sort folders by size with one command

Entire user’s data is under /home, I need to have a list of all the sub folders sorted by the size of the sub folders. simple command to get the list of sub folders sorted by their size: du --max-depth=1 /home/ | sort -n -r

Zombie Process

A process can be sleeping in kernel code. Usually that's because of faulty hardware or a badly written driver- or maybe a little of both. A device that isn't set to the interrupt the driver thinks it is can cause this, for example- the driver is waiting for something its never going to get. The process doesn't ignore your signal- it just never gets it. A zombie process doesn't react to signals because it's not really a process at all- it's just what's left over after it died. What's supposed to happen is that its parent process was to issue a "wait()" to collect the information about its exit. If the parent doesn't (programming error or just bad programming), you get a zombie. The zombie will go away if its parent dies- it will be "adopted" by init which will do the wait()- so if you see one hanging about, check its parent; if it is init, it will be gone soon, if not the only recourse is to kill the parent..which you may or may no