BEEP(1)
π BEEP(1) β User commands π
okay bestie, welcome to the BEEP(1) manual page. Itβs literally about making your PC speaker go beep, any number of ways. π
πΈ NAME πΈ
beep β beep the pc speaker any number of ways.
β¨ SYNOPSIS β¨
beep [GLOBALS] [-f FREQ] [-l LEN] [-r REPEATS] [<-d|-D> DELAY] [-s] [-c]
beep [GLOBALS] <TONE_OPTIONS> [-n|--new] <TONE_OPTIONS>
beep <-h|--help>
beep <-v|-V|--version>
π DESCRIPTION π
beep lets you control the PC speaker with precision, so different sounds can indicate different events. While beep can be run quite happily on the command line, its intended use is inside shell/perl scripts, notifying you when something interesting occurs. Of course, it has no notion of what IS interesting β itβs just really good at the notifying part. π«Ά
All options have default values, meaning that just typing beep will work. If an option is specified more than once on the command line, subsequent options override their predecessors. So beep -f 200 -f 300 will beep at 300Hz.
All durations are given in a unit of milliseconds, frequencies as Hertz, and the number of repeats is a dimensionless number. β¨
π OPTIONS π
π Global options π
-e DEVICE,--device=DEVICEβ Explicitly set the devicebeepshall use to generate beep tones. When not given a device explicitly,beepruns through an internal list of devices until one appears to work.--debug,--verboseβ Make thebeepprogram more verbose.
π΅ Tone options π΅
-f FREQβ Beep with a tone frequency ofFREQHz, where0 < FREQ < 20000. As a general ballpark, the regular terminal beep is around750Hz. For backwards compatibility, you can giveFREQas a floating point number, butbeepwill round that to integer values as the kernel APIs expect them. Default value:440 Hz.-l LENβ Beep for a tone length ofLENmilliseconds. Default value:200 ms.-r REPEATSβ Repeat the tone including delaysREPEATStimes. Default value:1tone, not repeated.-d DELAY|-D DELAYβ Specify a delay ofDELAYmilliseconds between repetitions. Small letter-dspecifies that this delay should only occur between beeps, that is, it should not occur after the last repetition. Capital letter-Dspecifies that the delay should occur after every repetition, including after the last one. Normally,-dis what you want, but if, for example, you are stringing severalbeepcommands together to play the star wars anthem, you may want control over every delay. Default value:100 msdelay between beeps with no delay after the last beep.-n,--newβ The--newoption allows you to chain multiple beeps together on a single command line. Each time the--newis used,beepstarts treating all further arguments as though they were for a new beep. So for example:
beep -f 1000 -n -f 2000 -n -f 1500
would produce a sequence of three beeps, the first with a frequency of 1000Hz (and otherwise default values), then a second beep with a frequency of 2000Hz (again, with things like delay and reps being set to their defaults), then a third beep, at 1500Hz. This is different from specifying a -r value, since -r repeats the same beep multiple times, whereas --new allows you to specify different beeps. After a --new, the new beep is created with all the default values, and any of these can be specified without altering values for preceding (or later) beeps. See the EXAMPLES section if this managed to confuse you.
-s,-cβ Both the-sand the-coption putbeepinto input processing mode, reading from stdin and copying all received data to stdout. This makes it easy to slipbeepinto a text processing pipeline to acoustically monitor the data flow within that pipeline. See the EXAMPLES section.-cβ Beep after every character received.-sβ Beep after every set of data received. Usually, this means after newlines occur in text processing pipes.
In a sequence of notes specified with one or more occurrences of -n or --new, it only makes sense to have one single note marked with either -s or -c attached to it. Then beep will beep all notes until it reaches that marked note, then repeat the marked note according to the input it receives, and once the input has reached EOF, beep will continue with the remainder of the note sequence.
The behaviour ofbeepwith more than one note marked with-sor-cis undefined. π
ποΈ Other Actions ποΈ
-h,--helpβ Displaybeepusage info and exit.-v,-V,--versionβ Displaybeepversion information and exit.
β EXIT STATUS β
When successful, beep returns with exit code 0.
Any non-0 exit code means beep has encountered an error and has bailed out.
π± ENVIRONMENT π±
BEEP_LOG_LEVELβ When set to a number between-999and999,BEEP_LOG_LEVELwill be used as the default loglevel until overridden by a command line parameter.
π FILES π
The device files beep uses by default are the following:
/dev/input/by-path/platform-pcspkr-event-spkr
/dev/tty0
/dev/vc/0
π§ NOTES π§
π οΈ Devices and Permissions π οΈ
When you run beep without explicitly giving a device to use, beep tries opening the following devices in sequence until one succeeds:
/dev/input/by-path/platform-pcspkr-event-spkrβ Uses the evdev API, and the system administrator can allow access to any set of users and groups using the normal file permissions./dev/tty0β Uses the console API, and the kernel insists you are root or own the TTY./dev/vc/0β Uses the console API, and the kernel insists you are root or own the TTY.
beepdoes not support running as setuid root or viasudo(1).
For non-root uses, the system administrator can set up a udev(7) rule to allow write access to /dev/input/by-path/platform-pcspkr-event-spkr for certain users and/or user groups. For details, see the beep /usr/share/doc/beep/PERMISSIONS.md file.
π§ APIs π§
evdev
Uses the input event device driver, which means running write(2) on /dev/input/by-path/platform-pcspkr-event-spkr.
The permissions to this device file can be set up such that beep can be run by any non-root user the system administrator wants to.
Opening this device takes on the order of magnitude of 20ms in the Linux kernel for every time you start the beep command. Therefore, if you need to play multiple notes in a rhythmical sequence for a melody, use one beep command invocation with multiple notes, not several beep invocations playing one note each. π₯
console
Uses the ancient console API, which means running the KIOCSOUND ioctl(2) on a tty device like /dev/tty0 or /dev/vc/0.
This requires being root, unless the non-root user happens to be logged into the virtual console and be using that specific virtual console device like e.g. /dev/tty4. This makes the console driver useless for non-root users logged in via ssh, and often X11 or Wayland.
Use the evdev API instead.
β οΈ Concurrent Invocations β οΈ
Concurrent invocations of beep are not supported. There is only one tone generator in the PC hardware, and we do not manage access to that shared resource in any way. So if a first beep -f 1000 -l 10000 process starts a long 10 second beep with 1000Hz, and 2 seconds later a second quick beep -f 2050 -l 100 with 2050Hz comes in, you will hear that 2050Hz beep for 100ms, and then silence as the quick beep silences the tone generator. Now you will not hear that the first beep process is still running after having waited for the first 2100ms of its 10000ms. You will also not hear that the first beep process will silence the already silent speaker 7900ms later, i.e. 10000ms after the first beep started.
π Sound Volume π
The PC speaker hardware has no way to explicitly set the volume of a beep.
If you have a standalone PC, however, chances are you have a piezo beeper connected to the mainboard. If you prioritize a loud beep over a certain frequency beep, you can choose to beep at a frequency close to the resonance frequency of the piezo beeper. Typical piezo beepers have a resonance frequency around 2000Hz, so you can test frequencies around that range. The authorβs piezo beeper is the loudest at about 2050Hz.
If you have a PC laptop, chances are that your laptop will not have a piezo beeper hardware inside and that it will route the output of the pcspkr circuit to the laptopβs internal speakers via the sound card mixer. In that case, you can and/or must change the mixer level for the beeper using a sound card mixer application.
πΆ Frequency Table πΆ
This frequency table might come in handy for translating musical notes to frequencies. The frequencies are rounded to integer numbers as the kernel driver only works with integers. The column for octave 4 is the octave of middle C.
The octaves are 3, 4, 5, and 6, bestie:
Cβ octave3:131; octave4:262; octave5:523; octave6:1047C#β octave3:139; octave4:277; octave5:554; octave6:1109Dβ octave3:147; octave4:294; octave5:587; octave6:1175D#β octave3:156; octave4:311; octave5:622; octave6:1245Eβ octave3:165; octave4:330; octave5:659; octave6:1319Fβ octave3:175; octave4:349; octave5:698; octave6:1397F#β octave3:185; octave4:370; octave5:740; octave6:1480Gβ octave3:196; octave4:392; octave5:784; octave6:1568G#β octave3:208; octave4:415; octave5:831; octave6:1661Aβ octave3:220; octave4:440; octave5:880; octave6:1760A#β octave3:233; octave4:466; octave5:932; octave6:1865Bβ octave3:247; octave4:494; octave5:988; octave6:1976Cβ octave3:262; octave4:523; octave5:1047; octave6:2093
π BUGS π
Report bugs to https://github.com/spkr-beep/beep/issues.
β¨ EXAMPLES β¨
okay bestie, this is where it gets fun β here are the example vibes, and yes, copy the commands exactly, no cap π
π± At its simplest (yet still effective)
literally just:
beep
π A more interesting standalone setup
this oneβs giving standalone main-character energy:
beep -f 300.7 -r 2 -d 100 -l 400
π¦ As part of a log watching pipeline
when youβre watching logs and want a beep in the mix:
tail -f /var/log/xferlog | grep 'passwd' | beep -f 1000 -r 5 -s
π When using -c mode
okay so when youβre using -c mode, I lowkey recommend a short -D, and a shorter -l, so that the beeps do not blur together. Something like this will get you a cheesy 1970's style beep-as-you-type-each-letter effect:
cat file | beep -c -f 400 -D 50 -l 10
π A highly contrived example of -n/--new usage
this one is highkey contrived, but it slaps:
beep -f 1000 -r 2 -n -r 5 -l 10 --new
it will produce first two 1000Hz beeps, then 5 beeps at the default tone, but only 10ms long each, followed by a third beep using all the default settings (since none are specified). periodt β¨
π SEE ALSO π
check these out too, bestie:
/usr/share/doc/beep/README.md/usr/share/doc/beep/PERMISSIONS.mdhttps://github.com/spkr-beep/beep
okay thatβs the whole BEEP(1) page β Linux, dated 2020-01-01 πππ«Ά
π¦ where this page comes from
- alpine 3.22: beep-doc 1.4.12-r1 Β· GPL-2.0-or-later
- alpine 3.23: beep-doc 1.4.12-r1 Β· GPL-2.0-or-later
- alpine 3.24: beep-doc 1.4.12-r1 Β· GPL-2.0-or-later
- arch rolling: beep 1.4.12-2 Β· GPL2
- debian bookworm: beep 1.4.9-1+b1 Β· GPL-2.0-or-later
- debian trixie: beep 1.4.9-1.1 Β· GPL-2.0-or-later
- ubuntu jammy: beep 1.4.9-1build1 Β· GPL-2.0-or-later
- ubuntu noble: beep 1.4.9-1.1ubuntu2 Β· GPL-2.0-or-later
- ubuntu resolute: beep 1.4.9-1.1ubuntu3 Β· GPL-2.0-or-later
- ubuntu stonking: beep 1.4.9-1.1ubuntu3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms