help set says:
-x Print commands and their arguments as they are executed.
It works both in interactive and non-interactive shells, so you can try running
set -x in an interactive shell to see the effect. Each command that is run is echoed to you first (with
+ signs in front of them to help you distinguish them from most regular output).
ek@Cord:~$ echo hello world
+ echo hello world
(If you see way more output than you expect an an interactive shell, your shell may be running commands to build your prompt. For example, you'll see about twenty additional lines if your prompt is set up to show information about the git repository you're navigated to, even if you're not actually in a repo now.)
To turn it off run
set +x. Somewhat confusingly, with
- enables a shell option and
+ disables it.
For more information, see 4.3.1 The Set Builtin in the Bash reference manual.