Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've seen demos where folks have had a Mac OSX terminal where the current time + username + directory are afixed (like 'freeze rows' in excel) to the top of the terminal window (not in the title bar), offering all the friendly context info I need while leaving lots of room for the command prompt after a simple '$'.

How do I tweak my Terminal to look like that?

PS. If it matters, I have recently started using an alternative shell called fish: but I'm happy with any answer for any shell.

EDIT: I went off to find the demo which first placed this idea in my head and I actually FOUND IT:

share|improve this question
What does that youtube link have to do with your question? – glenn jackman Apr 17 '14 at 20:47
It takes you to the exact spot in the video where the presenter is using Mac OSX terminal with some information pinned to the top. This is exactly what I want. – lmsurprenant Apr 24 '14 at 13:13

1 Answer 1

Edit 2:

Add these lines to your ~/.zshrc:

case $TERM in
    precmd () {print -Pn "e]0;%~a"}

This is the result:

enter image description here

If you are using bash:

case $TERM in
    PS1="[e]0;wa]\$ "
    PROMPT_COMMAND='echo -ne "${USER}@${HOSTNAME}:${PWD/#$HOME/~}"'

Have a look at this link. I think you'll enjoy it :)

Edit: another good link

share|improve this answer
Thanks for the advise. I'll review it and filter the content in a couple of hours – javierfdezg Apr 15 '14 at 10:34
Thanks for the links @oski but its not quite what I'm looking for. In fact, the first link is almost exactly what I'm using right now, only with fish shell this is one of the prebuilt prompt options available from the web-based fish_config. I just now went out and found the demo that I was thinking of and will add it to the question text to make it more clear. – lmsurprenant Apr 15 '14 at 12:29

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.