beep is a command-line tool in Linux that is used to emit a beep sound from the speaker of a computer. It is typically used as a notification or an alert in shell scripts or other command-line programs.
beep supports a variety of command-line options that allow you to customize the beep sound, such as the pitch, the duration, or the number of times the beep should be repeated. You can use these options to fine-tune the beep sound to suit your needs.
For example, to emit a beep sound with a pitch of 2000 Hz and a duration of 100 milliseconds, you could use the following command:
# beep -f 2000 -l 100
To emit a beep sound that is repeated 3 times, with a pitch of 1000 Hz and a duration of 200 milliseconds, you could use the following command:
# beep -f 1000 -l 200 -r 3
If you encounter the below error while running the beep command:
beep: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install beep |
Ubuntu | apt-get install beep |
Alpine | apk add beep |
Arch Linux | pacman -S beep |
Kali Linux | apt-get install beep |
Fedora | dnf install beep |
Raspbian | apt-get install beep |
beep Command Examples
1. Play a beep:
# beep
2. Play a beep that repeats:
# beep -r repetitions
3. Play a beep at a specified frequency (Hz) and duration (milliseconds):
# beep -f frequency -l duration
4. Play each new frequency and duration as a distinct beep:
# beep -f frequency -l duration -n -f frequency -l duration
5. Play the C major scale:
# beep -f 262 -n -f 294 -n -f 330 -n -f 349 -n -f 392 -n -f 440 -n -f 494 -n -f 523