I want to run a command before and after every single command that gets executed in a terminal (i.e. clear
before and then reset
). I want this to happen automatically and not with a short alias or similar.
I have looked into bashrc and /usr/share/bash-completion/bash_completion although the latter seems to be just for the auto completion feature with the Tab?
Where should I make my changes?
Best Answer
In your
.bashrc
:For a good example see "Make gnome-terminal show the command running as title" on AskUbuntu.
To solve the original poster's request to run
clear
before the command andreset
after the command, add to.bashrc
:In
man bash
look forPROMPT_COMMAND
andtrap .-lp
.