Search code examples
linuxbashterminalps1xfce

Linux Terminal PS1


I am not sure if this is possible but I couldn't find the answer anywhere else or even people who have tried it but my current PS1 is this:

export PS1="\[\e[00;32m\]??\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[01;31m\]\d\[\e[0m\]\[\e[00;37m\] \[\e[0m    \]\[\e[01;31m\]\T\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[00;32m\]>\[\e[0m\]"

It is showing up and working upon opening the terminal however I am wondering if it was possible to clear the screen after a command finishes (with a prompt similar to windows cmd 'pause' command if possible) so that it isn't repeated or shown at the bottom of the window

I am running Manjaro XFCE if it makes a difference.

Thanks!


Solution

  • You can try something like this:

    PS1='$(echo "(press enter to continue)" > /dev/tty ; read ; clear) $ '
    

    NOTE: You need the redirect > /dev/tty because the standard output of the commands run by PS1 goes nowhere.

    Replace the ending $ with whatever prompt you want to show.

    I don't really think it is such a good idea. In the short time I've been testing that, it is so irritating!!!

    I think you are way better just pressing Ctrl+L befor typing your command to clear the terminal.