Linux – Why is the Linux system repeating every command that I type

command linelinux

I'm using a Ubuntu Linux system, and every command I enter is displayed on the next line, followed by the output of the command. For example:

root@dpkube165:~# ls
ls  <--- why is this here?
Desktop  Documents  Downloads 

root@dpkube165:~# date
date  <--- or this?
Mon Mar 19 11:24:59 EDT 2018

root@dpkube165:~# echo "Hello, world!"
echo "Hello, world!" <--- or this?
Hello, world!

I thought it might have to do with the prompt, which is as follows (PS1):

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

but reviewing online guides to prompt escape sequences didn't turn up anything obvious.

Best Answer

It looks like you have -v set (something is running set -v).

To reverse this, run set +v.

set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
       Without  options, the name and value of each shell variable are displayed in a
       format that can be reused as input for setting or resetting the currently-set
       variables. Read-only variables cannot be reset. In posix mode, only shell
       variables are  listed. The output is sorted according to the current locale.
       When options are specified, they set or unset shell attributes. Any arguments
       remaining after option processing are treated as values for the positional
       parameters and are assigned, in order, to $1, $2, ...  $n.  Options, if
       specified, have the following meanings:

[...]

-v      Print shell input lines as they are read.

See the bash manpage (under the "Shell Builtin Commands" section) for more information on the set built-in command.

Alternatively run help set from within bash for more direct access to the help text.

Related Question