beep Command Examples in Linux

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.

To use beep, you will need to have the beep package installed on your Linux system. You can install beep using the package manager for your specific distribution of Linux. For example, on an Ubuntu system, you can use the apt command to install beep:

# apt install beep

Once beep is installed, you can use it to emit a beep sound by running the beep command. By default, beep will emit a single beep sound with the default pitch and duration. 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

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
Related Post