Go to content Go to navigation Go to search

Customizing Your Prompt · Oct 12, 11:55 AM by Dylan Doxey

So, you're on your system messing about, and then you realize, "Hey, I thought this was the development machine!" Yes, it happens. You're fiddling about with thing you shouldn't have on your production box.

I thought it would be nice if my terminal would change to a different profile depending on what machine I've initiated an SSH session with. This is certainly feasible, if you're a pretty good C++ programmer, and you feel like spending some time modifying your terminal application. This is not me.

Instead I thought I'd looking into setting up a custom prompt.
By default the prompts on all the machines I work with are like:

dylan@dev: /home/dylan$

So, what's the problem? The machine name is always right there.

I want more.

Here's a nice IBM article on how to use ANSI colors in your prompt.
http://www.ibm.com/developerworks/linux/library/l-tip-prompt/


Here's what I've come up with for myself.

$ export PS1="\[\e[32;1m\]\u@\H\$: \[\e[37;1m\]\w \[\e[0m\]"
dylan@dev.doxey.org$: /usr/home

$ export PS1="\[\e[33;1m\]\u@\H\$: \[\e[37;1m\]\w \[\e[0m\]"
dylan@qa.doxey.org$: /usr/home

$ export PS1="\[\e[31;1m\]\u@\H\$: \[\e[37;1m\]\w \[\e[0m\]"
dylan@prod.doxey.org$: /usr/home



Happy computing.

Commenting is closed for this article.