Search code examples
cygwincommand-prompt

what is the alternative of `prompt $g` in cygwin


In Windows, I can use prompt $g to hide the path and replace it with > in the command prompt as shown in the below picture,

enter image description here

This is extremely beneficial if the path of the current directory long. I'm looking for similar command for cygwin. Any suggestions?


Solution

  • The shell's prompt is taken from the $PS1 variable. If you want to show just >, set the variable to it

    PS1='>'
    

    It might be more convenient to use something like \W which displays the current directory name without path:

    PS1='\W> '