Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugultopu/d94d7dfa9e7e523240a80afd26d2191c to your computer and use it in GitHub Desktop.
Save ugultopu/d94d7dfa9e7e523240a80afd26d2191c to your computer and use it in GitHub Desktop.

All you need to do is to modify your PROMPT_COMMAND environment variable so that it will send an alert (bell). The value of PROMPT_COMMAND is evaluated before every command prompt, meaning that it is evaluated after the end of every command.

To do so, open the startup file of your shell and append ; tput bel (or ; echo -e '\a') to the value of PROMPT_COMMAND. If PROMPT_COMMAND isn't present, create it with the value:

PROMPT_COMMAND+='; tput bel'

Now, you will get an alert after the end of every command, unless the terminal tab is focused when the command is finished.

Terminal gives you a couple options for configuring the alert (bell) behavior. You can access these by:

  • Opening Preferences.
  • Selecting Profiles.
  • Selecting your profile.
  • Clicking on the Advanced tab.
  • Modifying the options under the Bell section.

Credits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment