Search code examples
unixterminalformatcommandxterm

Change terminal command line format


I was trying to change the format of my terminal from

john@example.com /home/directory
$

to this:

/home/directory>

Anyone knows how to do it?

I am using unix, xterm.


Solution

  • You can do it with the following:

    export PS1="$PWD> " #this will always show the dir you were when performing the command
    export PS1='$PWD> ' #this is the correct
    

    Note that this will work for your current session. To make it persistent, add the line to your ~/.bashrc file.

    For comprehensive information about this topic, you can check How to: Change / Setup bash custom prompt (PS1).