Customize the Command Line by Adding Emoji Icons to the Bash Prompt

Apr 8, 2013 - 8 Comments

A very unique and amusing way to customize the bash prompt appearance is to add one of OS X’s Emoji icons to transform the appearance of the prompt itself. This isn’t going to be the most practical tweak in the world on it’s own, but it is entertaining and because it’s using traditional methods of customizing the bash prompt you can make it as useful or useless as you want.

Emoji prompt

Here’s how to add an emoji icon as the command line prompt:

  • Open Terminal app and use your preferred command line text editor to modify the .bash_profile file:
  • nano .bash_profile

  • Add a new line like the following:
  • PS1=" "

  • Now pull down the “Edit” menu and choose “Special Characters”, then select “Emoji” from the special character menu
  • Find the Emoji you want to use in the shell prompt and drag & drop it into the PS1=” ” line so that it’s contained within the quotes

Add Emoji icons to the Terminal prompt

  • Depending on terminal settings, nothing may be visible after using drag & drop, but put two spaces after the blank space where the emoji was dropped, it will end up looking something like this: PS1=”     “
  • Save the .bash_profile change with Control+O (for nano) then exit out of nano with Control+X
  • Open a new Terminal window to see the emoji as the prompt

With only an Emoji set in there, the new bash prompt will look like this:

Emoji bash prompt

The emoji tends to look best as a prompt when the Terminal font size is fairly large, perhaps larger than you’re accustomed to. This is particularly the case with complex emoji icons, but for basic icons like stars, shamrocks, and thumbs up the smaller fonts still look ok.

Shamrock emoji prompt

This is more fun than anything else, and if you’re an avid terminal user you probably will find this more ridiculous than functional depending on how you’ve customized the bash prompt outside off this, though you can still apply the typical formatting customizations alongside the Emoji as well. One common and particularly useful customization is to show the current working directory, that can be added by changing the PS1=” ” command to the following:

PS1="(drop emoji here) \W "

Or reversed:

PS1="\W (drop emoji here) "

And, getting increasingly useful with a username @ hostname visible with the emoji and PWD as well:

PS1="\u@\h (drop emoji icon) \W "

Customized emoji shell

Remember to add a space (if not two) to after the Emoji or else it will be cramped against the command prompt.

If this is a bit too outrageous for you, check out a guide to improve the overall Terminal appearance and another excellent trick to make it more readable by adding a separator between commands that have been executed.

Heads up to Torrez for the funny tip idea by way of DaringFireball

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Command Line, Customize, Mac OS X, Tips & Tricks

8 Comments

» Comments RSS Feed

  1. Wojtek says:

    Yes, but the question is: why? Terminal is supposed to be useful and having an icon isn’t going to help that. Why not post some tips on how to actually make it work for the benefit of the user?

  2. eSol says:

    Wojtek, I bet your favourite colour is Beige. Have a little fun sometime.

  3. Henry says:

    I think it’s actually very useful! If you select the right icon (colour-wise) it might help to see differentiate the prompt (as well as entered commands) from the cmd output.

  4. mrics says:

    I think is better open .bash_profile with textedit with “open -e .bash_profile” and than write the PS1″ ”

    mine is this:

    export PS1=”\[33[36m\]\u\[33[m\]@\[33[32m\]\h (drop emoji here)(space):\[33[33;1m\]\w\[33[m\]\$”

    thanks for the trick!

  5. Ben says:

    Is there any way to get alpha channel support for the emojis inside the terminal window?

    Mine is set to semi-transparent black, but the emojis don’t seem to support it, which means a square completely transparent box shows around them. Just looks ugly that way, that’s all.

    Nice tip though, thanks.

  6. adam says:

    Useless, but so Groovy, Thanks

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates