2

I'm currently customizing my terminal/bash command prompt for my mac. I was wondering if there was a way to keep the actually prompt in the middle/top top of page after running each command. I hate when it gets to the bottom of the screen then I have to clear it to get back to the top.

cmr
  • 101
  • 5
  • Maybe [this](http://stackoverflow.com/q/2198377/5128464) might help you (there is a shortcut to clear the screen). – vlp Sep 16 '15 at 23:23

1 Answers1

2

You can use an ANSI escape character to reposition the cursor prior displaying the prompt, but I don't think you're going to like the result; it's going to put the prompt above or on top of the output from the previous command.

PS1='\[\e[1;1H\]> '

"1;1" here represents the upper left-hand corner; you can vary the numbers to choose a different row/column if desired.

chepner
  • 446,329
  • 63
  • 468
  • 610