arecord is a command line utility for recording audio on a Linux system. It is part of the alsa-utils package, which provides command line utilities for the Advanced Linux Sound Architecture (ALSA) on Linux.
To use arecord, you need to specify the name of an audio device to record from and a filename to save the recorded audio to. For example, the following command will record audio from the default audio input device and save it to a file called recording.wav:
# arecord -f cd -t wav recording.wav
arecord supports a variety of options to control the recording process, such as specifying the audio format and sample rate, setting the recording duration, and enabling or disabling audio effects such as noise reduction. You can view a full list of options by running man arecord in the terminal.
It’s worth noting that arecord is just one of several tools available for recording audio on a Linux system. Other options include rec from the sox package and parec from the pulseaudio-utils package.
If you encounter the below error while running the arecord command:
arecord: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install alsa-utils |
Ubuntu | apt-get install alsa-utils |
Alpine | apk add alsa-utils |
Arch Linux | pacman -S alsa-utils |
Kali Linux | apt-get install alsa-utils |
CentOS | yum install alsa-utils |
Fedora | dnf install alsa-utils |
Raspbian | apt-get install alsa-utils |
arecord Command Examples
1. Record a snippet in “CD” quality (finish with Ctrl-C when done):
# arecord -vv --format=cd {{path/to/file.wav}}
2. Record a snippet in “CD” quality, with a fixed duration of 10 seconds:
# arecord -vv --format=cd --duration={{10}} {{path/to/file.wav}}
3. Record a snippet and save it as an MP3 (finish with Ctrl-C when done):
# arecord -vv --format=cd --file-type raw | lame -r - {{path/to/file.mp3}}
4. List all sound cards and digital audio devices:
# arecord --list-devices
5. Allow interactive interface (e.g. use space-bar or enter to play or pause):
# arecord --interactive