title: How can I make my terminal prompt extend the width of the terminal?
body: <p>I noticed in <a href="https://www.youtube.com/watch?v=h2wo0g5fH7c" rel="noreferrer">this video</a>, that the terminal prompt extends the entire width of the terminal before breaking down to a new line.  How can I set my <code>PS1</code> variable to fill the remaining terminal space with some character, like the way this user did?</p>
  
  <p>The issue is, I don't know how to update the <code>PS1</code> variable per command.  It seems to me, that the string value for <code>PS1</code> is only read in once just as the <code>.bashrc</code> file is only read in once.  Do I have to write some kind of hook after each command or something?</p>
  
  <p>I should also point out, that the <code>PS1</code> variable will be evaluated to a different length based on the escape characters that make up it.  For example, <code>\w</code> print the path.</p>
  
  <p>I know I can get the terminal width using <code>$(COLUMNS)</code>, and the width of the current <code>PS1</code> variable with <code>${#PS1}</code>, do the math, and print the right amount of buffer characters, but how do I get it to update everytime.  Is there a preferred way?</p>