This tip is dumb, but is a good thing when it’s needed, because we never remember how to do it (at least I don’t).
If you need to configure your keyboard, because the keys are not inputing right chars, use the command below:
sudo dpkg-reconfigure console-setup
This way, you can select the correct layout.
In case of being a Brazilian layout, the recommended options would be: