How can I make ring the bell from command line using WSL (2)?

I tried:

echo -ne '\007'
echo -e "\a"

I have set bellstyle none in /etc/inputrc.

Using Ubuntu 18.04 image.

  • 2
    Uhh why did you set bellstyle none if you want the bell to ring? echoing the bell character in my WSL produces the default windows "ding"
    – Panki
    May 7, 2020 at 19:50
  • 1
    I don't want the shell to beep all the time, it is super annoying and should be turned off by default IMO. Though I would like to start a long lasting process and then play a sound, so I know when it is finished and don't have to check visually all the time. E.g. I can go read something.
    – Soerendip
    Dec 14, 2020 at 19:50

1 Answer 1


In WSL Ubuntu or Alpine with default path setup, you can depend on .net's Console.Beep method:

powershell.exe '[console]::beep(261.6,700)'

It makes a handy alias for etc/profile or ~/.bashrc:

alias bloop="powershell.exe '[console]::beep(261.6,700)'"

Define a helper function to create multiple tones:

_beep () {
  powershell.exe "[console]::beep($1,$2)"

alias bleep="_beep 1000 800"  # A strong bleep (for profanity)
alias  beep="_beep 2000 300"  # Quick yet noticeable beep
alias  blip="_beep 4000  80"  # A less distracting blip

Example: Blip on success, but bleep on failure:

make && blip || bleep
  • If PATH is broken, it might be due to these (1, 2) WSL settings. In a pinch, adding /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/ to the path may fix the issue
    – Max Suica
    Dec 12, 2020 at 1:22
  • It works ! :-).
    – Soerendip
    Aug 24, 2021 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .