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.
Asked
Active
Viewed 1,234 times
1 Answers
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