I was trying to use arecord to record a wav file, but instead of recording to one file, it created tens of thousands of files (around 60000). This happened after I had installed the alsaequal package. I used to record using the -f dat flag with arecord, but after I installed alsaequal, this stopped working so I tried to use -f cd, which is when this problem occured. I don't know if it is alsaequal that is causing this behavior or the use of the cd format. I am using Arch Linux on a Raspberry Pi. The full command that I ran was arecord -f cd test.wav and the files it outputted were all named test-xxxxx.wav Does anyone have any idea what might be causing this problem?

Update: This seems to happen randomly. It will work fine for a bunch of recordings and then I restart or run arecord with slightly different arguments, which will cause the problem to occur each time I record (no matter what arguments I use). I haven't been able to find a reproducible pattern.

1 Answer 1


It appears that when arecord receives a SIGINT it gets upset and creates thousands of files. (This will happen if you Ctrl-C whilst it is recording.) I'm not sure how to "fix" it (I'd classify it as a bug, anyway), but I will offer two workarounds:

  1. Don't SIGINT, just SIGKILL (killall -KILL arecord)

  2. To prevent thousands of files being created do the following instead:

    arecord - > /tmp/sample.wav 2> /dev/null

    Now, instead of producing sample-1.wav, sample-2.wav, etc, arecord sends all it's data to STDOUT, which you redirect to a file of your choice. Messages are printed to STDERR which is redirected to /dev/null in this case. The tradeoff is that instead of thousands of files being created, that single file will grow very large - which may or may not be considered as an improvement!

As a bonus gift; since the classic "rm /tmp/sample*.wav" is likely to report "too many files"; here is how to clean up the mess (adjust as appropriate):

find /tmp -type f -name sample*.wav -exec rm {} \+

Just for the record:

$ arecord --version
arecord version 1.0.27 by Jaroslav Kysela <perex@perex.cz>
  • This seems to have worked, as far as I can tell.
    – lopsided98
    Jun 1, 2013 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.