bash: __vte_prompt_command: command not found - linux

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

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.

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.

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

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

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

Related

Changing shell from /bin/bash to /bin/zsh disappears programming tools?

I became very interested in Linux and wanted to customize my terminal with ZSH and powerlevel10k, but after changing and logging out, the programming tools disappears. I tried very hard to understand the reason but it did not work. I am not very familiar with the $PATH command and I do not know if it works or not. Thanks for your help.
image link => https://i.stack.imgur.com/BLeLe.jpg
Changing default shell to ZSH can help
first find the path of your ZSh shell.
type -a zsh
then change it
chsh -s /bin/zsh
now log out and log in again. One can close the Terminal app and reopen it.
After digging, I finally realized that the files that were installed with SNAP are not displayed. When I installed the file in Deb format, it became known.

bash: /home/x/.bash_profile: Permission denied. How to fix this issue?

I am trying to open the bash_profile file but it gives the following result
~/.bash_profile
bash: /home/x/.bash_profile: Permission denied
After searching I found this solution on the internet
source ~/.bash_profile
But this command gives the following output
The program 'the' is currently not installed. You can install it by typing:
sudo apt install the
when I typed it gives this result
sudo apt install
[sudo] password for x:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove, and 0 not upgraded.
x#ubuntu:~$ source ~/.bash_profile
The program 'the' is currently not installed. You can install it by typing:
sudo apt install the
please help me how to fix it.
Thank you All.
For viewing the bash_profile:
cat ~/.bash_profile
For editing:
vi ~/.bash_profile
If you get a permission denied, use sudo before cat or vi commands.
Hello
And for only creating your own without editing it...
set -x && $(type -p touch) ${HOME}"/.bash_profile"; set +x
... if already exists then only the modification time is changing.
I wrote the simple command cryptic because set -x shows what going on and set +x exits the debug mode.
After the clarifications, let me tell you what is happening.
The ~/.bash_profile file is a configuration file for configuring user environments. The users can modify the default settings and add any extra configurations on it. In your case, the file is empty and it is throwing an error because inside the file you have the word "the".
You Linux Server is trying to run the command "the", so the reason for the error you are getting is that you have no execution privileges over it. I've never ever heard of a program called "the", but giving your error perhaps the program is there. If the program did not exist, you would have gotten "No such file or directory".
Replace the content of the .bash_profile with the minimum content you need for this kind of file:
$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH=.:$PATH:$HOME/.local/bin:$HOME/bin

(oh-my-)zsh behaviour: `$ command_name` at home directory results in `cd command_name` effect

I'm currently using zsh with oh-my-zsh, and I've run into an annoying shell behaviour.
I must have done a subtle yet breaking change in the $PATH export while editing my .zshrc, because the following thing happens:
At the shell prompt while in ~/, issuing, for example, the flutter command...
$ flutter
...results in:
$ ~/flutter/
(as if calling $ flutter had been interpreted as $ cd flutter)
However, issuing $ flutter in any other directory, including $ ~/flutter results in the correct execution of the flutter command. Same thing for go and others.
Line 2 on my .zshrc exports $PATH in the following fashion:
export PATH=$HOME/bin:$HOME/.emacs.d:$HOME/flutter/bin/cache/dart-sdk:$HOME/flutter/bin/cache/dart-sdk/bin:$HOME/.pub-cache/bin:$HOME/.composer/vendor/bin:$HOME/.cargo/env:$HOME/.platformio/penv/bin:$HOME/flutter/bin:$PATH
I've been comparing .zshrc versions with other backups, and I may be missing something, but no differences were found.
What seems off, in your opinion?
If you've encountered this annoyance before, how did you correct it?
Explanation
It'a feature called AUTO_CD.
AUTO_CD (-J)
If a command is issued that can’t be executed as a normal command, and the command is the name of a directory, perform the cd command to that directory.
http://zsh.sourceforge.net/Doc/Release/Options.html#Changing-Directories
AUTO_CD is enabled by oh-my-zsh in file oh-my-zsh/lib/theme-and-appearance.zsh.
...
setopt auto_cd
setopt multios
setopt prompt_subst
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
...
Solution
Append the following command in ~/.zshrc after oh-my-zsh is loaded to disable this feature.
unsetopt AUTO_CD

Human friendly bash auto-completion with sudo

My system is Manjaro Linux based on Arch Linux, I use bash and bash-completion.
It works perfectly when I type something as regular user (no sudo)
$ rfkill <TAB><TAB>
block event help list unblock
but when I type it with sudo
$ sudo rfkill <TAB><TAB>
Display all 3811 possibilities? (y or n)
Obviously, it tries to complete sudo command but I want it to complete rfkill.
I know I can change this behavior by editing /usr/share/bash-completion/completions/sudo file, but I have no idea how to say if second word is not a flag for sudo then use completion for next word.
Do you have?
UPD: I'm testing Ubuntu 16.04 in virtual machine and I see it works as expected. I'll check the difference between ubuntu's /usr/share/bash-completion/completions/sudo file and mine, if any.
UPD2: There is some mirror (meaningless) difference between these files, anyway that didn't help. I have more ideas to test...
I had exactly the same problem (running Manjaro) and found a solution in the Manjaro Forum (Source):
Make sure bash-completion is actually installed by checking whether /usr/share/bash-completion/bash_completion exists. If not install it with pacman -S bash-completion
In your ~/.bashrc file make sure that complete -cf sudo is commented out. Otherwise, this will make sudo only auto-complete filenames and commands but not use bash-completion.
I hope this helps you solving the problem
use double tab:
sudo rfkill <TAB><TAB>
UPD
if there is not that line, add this to your .bashrc
complete -cf sudo

How to fix path variable in bash on Mac OSX Snow Leopard

This might be a noob question, but I need help. I screwed up my terminal by trying to alter my path variable using the following command:
$ sudo nano .profile
Before I did that, if I were to type:
$ echo $PATH
I would get: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
When I opened .profile in nano it told me that the file didn't exist. I figured that made sense, since I had never edited this file before. I proceeded to enter a path to a directory I was using for a php framework and saved the file.
After I saved the file, I noticed that none of my bash commands are working. Now I can't do anything from the terminal. I can't even edit .profile in nano because it says -bash: nano: command not found
I'm clearly new to working with the terminal. I feel completely lost. Please provide some guidance on how to restore the terminal to working condition.
Use absolute paths.
$ /usr/bin/sudo /usr/bin/nano .profile
If you add something to a path, never just do
PATH=/path/to/something
instead do
PATH=$PATH:/path/to/something
By the way, you shouldn't/don't have to use sudo to edit your own file, such as .profile. Use sudo only when you need to edit the file which doesn't to belong to your account.
I had the same problem!
The way I solved was writing the follow command in the terminal:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin
Hope it can be useful for you

Resources