bash: __vte_prompt_command: command not found
Asked Answered
M

6

12
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

Moorhead answered 9/3, 2014 at 11:57 Comment(4)
can you show your ~/.bashrc content?Go
and what does echo $PS1 show?Oscitancy
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.Oscitancy
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 @Oscitancy :)Moorhead
E
15

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.

Estellaestelle answered 18/8, 2014 at 21:23 Comment(1)
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 advanceFuld
P
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.

Pragmatic answered 3/3, 2019 at 16:21 Comment(1)
Same here, tried to use Tilix, added a line to .zshrc and forgot about it :) Thank you!Agrigento
E
2

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.

Emeric answered 2/5, 2023 at 21:19 Comment(0)
K
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
Kautz answered 15/6, 2018 at 14:24 Comment(0)
I
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

Intermigration answered 27/6, 2017 at 11:58 Comment(0)
S
0
set +v 

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

so set i
Sacken answered 8/9, 2021 at 17:38 Comment(1)
sry the line was cut. what i mean is just give the command: set +vSacken

© 2022 - 2024 — McMap. All rights reserved.