Changing terminal settings with stty
In this recipe, we'll learn how to change the settings (or attributes) of our terminal. In the previous recipe, we listed our current settings with stty -a
. In this recipe, we'll change some of those settings, using the same stty
program.
Knowing how to change your terminal settings will enable you to adapt it according to your preference.
Getting ready
No special requirements exist for this recipe.
How to do it…
Here, we will change some of the settings for our current terminal:
- Let's start by turning off echoing. Doing so is common—for example, for password prompts—but it can also be done manually, as we'll see here. After you turn off the terminal echo, you won't see anything you write. Everything still works, though—for example, we can type
whoami
, and get an answer. Notice that you won't see thewhoami
command as you type it:$> stty -echo $> whoami jake ...