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: