11
bash: __vte_prompt_command: command not found

Whenever I open a terminal, I am greeted with this line. Also, this is printed each time I enter a command in the terminal.

I am a linux-noob, and would be happy to read up, if someone can point me to some resource, or hint at a possible solution. I tried google-ing, but was unable to turn up with any useful results.

I did not do anything specific just before this started popping up.

Thanks in advance :)

Additional Info:

  • The terminal I used is the default gnome-terminal

  • Fedora 20

pradeepcep
  • 902
  • 2
  • 8
  • 24
  • can you show your ~/.bashrc content? – Farvardin Mar 09 '14 at 12:08
  • and what does `echo $PS1` show? – m.wasowski Mar 09 '14 at 13:47
  • You should also check for file /etc/profile.d/vte.sh which is installed as part of libvte packgage. You probably source this file in your ~/.bashrc script, but vte.sh is missing now and hence your error. – m.wasowski Mar 09 '14 at 13:59
  • 1
    I restarted the system, and this solved the problem. Unfortunately, I failed to look at `~/.bashrc` before restarting. I will try to reproduce the problem, and will post if I succeed. Thanks @HomayounAfshari and @m.wasowski :) – pradeepcep Mar 09 '14 at 14:22

6 Answers6

14

It sounds like a program named VTE has set your bash environment variable PROMPT_COMMAND to invoke a function called __vte_prompt_command.

The PROMPT_COMMAND environment variable defines a command that is executed before every new prompt is displayed to the screen. It can be very annoying when this command produces unexpected output.

You can temporarily get rid of the annoying messages by entering this command in the terminal:

__vte_prompt_command() { true; }

This creates a dummy function that does nothing - you can confirm by looking at the output of this command:

type __vte_prompt_command

After applying the hack to my system I see this:

__vte_prompt_command is a function
__vte_prompt_command ()
{
    true
}

However, this is an indication that VTE may not be installed properly and/or may be broken. You might want to try to reinstall VTE, if possible. I would not recommend putting this permanently into your ~/.bashrc file.

carl.anderson
  • 1,040
  • 11
  • 16
  • well this code ' __vte_prompt_command() { true; } ' solved temporarily for me the problem but I want that it disappears forever and that It can be solved properly . Thanks jn advance – Ahmed C Mar 04 '20 at 20:32
3

I am running Ubuntu 18.04 with the default gnome-terminal and ran into the same problem but wanted a definitive solution.

After trying the solutions suggested previously, I still had the message:
__vte_prompt_command: command not found
comming up after starting a new terminal and after each command terminated.

I searched for a file in for instance .bashrc, .profile that would be doing a source /etc/profile.d/vte-2.91.sh with no luck.
Than I remembered that a long time ago I added the following line in my ~/.bashrc:

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

in order to append command line histories to all opened terminals. I figured out that commenting it solved the problem.

#export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

than
$ source ~/.bashrc

Thought I would share this for anyone having the same problem.

Gabriel Cretin
  • 365
  • 3
  • 16
1

You can disable the corresponding code by editing your ~/.bashrc by using sudo gedit ~/.bashrc, searching for the string "vte" with STRG+F and outcommenting the line with a #. On my system, the line looked like this, I guess an old installation of Ubuntu Budgie put it there:

if [ $TILIX_ID ] || [ $VTE_VERSION ] ; then source /etc/profile.d/vte.sh; fi # Ubuntu Budgie END

And if it looks like this, the line in your terminal will not appear anymore:

#if [ $TILIX_ID ] || [ $VTE_VERSION ] ; then source /etc/profile.d/vte.sh; fi # Ubuntu Budgie END
Moritz
  • 81
  • 1
  • 5
1

I was hitting this issue as well. To diagnose it, I used ag to find files on my system containing __vte_prompt_command:

> sudo ag -l __vte_prompt_command 2>/dev/null /

The first result that turned up was /etc/profile.d/vte-2.91.sh. Looking into that file, I see an early exit if your terminal isn't named according to its expectations:

# TERM not supported?
case "$TERM" in
    xterm*|vte*|gnome*) :;;
    *) return 0 ;;
esac

In my case, I think here's the explanation:

  1. When I open a terminal, TERM was set to xterm-256color. vte-2.91.sh would execute, __vte_prompt_command would be defined, andPROMPT_COMMAND would be set.
  2. I would start a tmux session. Tmux would set TERM to 'screen'. vte-2.91.sh would execute, but because TERM had changed, the script would exit early. __vte_prompt_command would not be defined.
  3. My shell config would execute PROMPT_COMMAND, calling __vte_prompt_command, which isn't set, hence the error message.

There's clearly some kind of problem with vte-2.91.sh. But I worked around this by configuring tmux to set TERM to something vte was expecting:

set -g default-terminal "xterm-256color"

It's all a bit convoluted, but I suspect a similar explanation in your case.

tdy
  • 36,675
  • 19
  • 86
  • 83
0

For CentOS7 (64 bit):

Try installing using yum command.

sudo yum update -y
sudo yum install -y terminator
sudo yum install -y epel-release
sudo yum install -y terminator #again

Resart the command prompt terminal, This worked for me (:

Reference: http://bytefreaks.net/gnulinux/install-terminator-in-centos-7-64bit

Walk
  • 1,531
  • 17
  • 21
0
set +v 

I think you may somehow made: set -v (Prints shell input lines as they are read.)

so set i
bad_coder
  • 11,289
  • 20
  • 44
  • 72
johnny
  • 1