This content originally appeared on @mdo and was authored by Mark Otto
The default Terminal prompt is kind of bad—it tells me very little and doesn’t look super fly. After a bit of research, I learned how to customize colors, characters, variables, and show my git branch name.
Here’s what the default Terminal looks like:
Plain, and some what informative, but I don’t care about most of this. I know who I am and what computer I’m using, so that can go away. I also don’t need a $ to identify new lines. What I do need is some flavor, the path, and some git info. So I cooked up my own prompt to give me just that. Now, it looks like this:
To use this yourself, open ~/.bash_profile
in your favorite editor, and add the following snippet:
Save your changes and restart Terminal. Voilà. Breaking it down some, here’s what’s going on in this snippet, as outlined by this Geek Stuff article:
\e[
starts a new color, while\e[m
ends it.0:35
is the color we’re setting for the ⌘ character. All declared colors take on the format ofX:Ym
(yes, the m is required).\w
is a variable for outputting the current path. Other available variables include\h
for hostname and\u
for username.- Lastly, we grep throught the list of branches and output that.
Honestly, I don’t know much about the last part, but it’s a small script I picked up on with a big of Googling and has worked without a hitch so far.
Anywho, that’s it. You can easily swap out the ⌘ special character and change the colors to make it your own. Enjoy!
This content originally appeared on @mdo and was authored by Mark Otto
Mark Otto | Sciencx (2012-10-18T00:00:00+00:00) Terminal hotness. Retrieved from https://www.scien.cx/2012/10/18/terminal-hotness/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.