Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is common to cram useful information in the Unix shell prompt, but I have too many things I want to keep an eye on to fit it all in one prompt: current Gnu screen window, current directory, current time, hostname, current git branch, phase of the moon, you-name-it.

It would be saner to have a fixed status region at the bottom (or top) of the terminal to show all this information, and leave the prompt alone. (I wrote "fixed status region" rather than "fixed status line" because I don't want to limit myself to one line.)

(This region, of course, would not be affected by normal interactive output.)

Is there a standard Unix to implement such a fixed status region, and would allow me to update it through the precmd function?

share|improve this question

You could split your screen horizontally in screen, set one area the size you want for your status region, and run some watch -t cat ~/.status in it and then fill the content of that ~/.status in your precmd().

share|improve this answer

If your terminal supports terminal addressing, save cursor and restore cursor, this might work:

PS1="$(tput sc;tput cup 0 0;tput rev;tput el)\u@\h \W$( tput rc;tput sgr0)\$ "

But beware that the command can be difficult to edit as the shell gets confused about where it is in the input buffer.

In bash, you can tell it to ignore the cursor control sequences using backslash-square brackets:

PS1="\[$(tput sc;tput cup 0 0;tput rev;tput el)\]\u@\h \W\[$( tput rc;tput sgr0)\]\$ "

If this doesn't work, try sending the output direct to the terminal:

TOSL=$(tput sc;tput cup 0 0;tput rev;tput el)
FROMSL=$(tput sgr0; tput rc)
PS1='$(echo -n "$TOSL $LOGNAME@$HOSTNAME ${PWD/#$HOME/~}$FROMSL">/dev/tty)\$ '
share|improve this answer

AT&T Unix had sysline command, which provided a status line for terminals that don't have it in hardware. Maybe there is a GNU equivalent by now...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.