Search code examples
kshaixrm

How rm * works in case of huge number of files in AIX (ksh)


Is there any limit of arguments that can be passed to rm command in AIX? I use ksh. I tried to run

rm *

in one catalog where is >500 000 (now) files but I received strange error. If I remember correctly it was something like "memory core dump". What does it mean? Can I suppose some files were removed? I don't know how many files were there before I executed this command.

I think shell was not able to collect all filenames and pass those to rm command so nothing was removed, but I really don't know. Can someone advise me how it works?


Solution

  • How long an argument list is allowed to be is defined by ARG_MAX which you can query using getconf, e.g.:

    $ uname -o
    GNU/Linux
    
    $ getconf ARG_MAX
    2097152
    

    This is not a limit set by the shell but by the underlying system call(s) involved.