Tuesday, April 9, 2013

Customize the Command Line by Adding Emoji Icons

8:38 AM

Note: If this tutorial worked for you (and it should work), please leave a comment below. Thanks.

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.

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
  • 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:


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.

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 "
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.



Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 iFlasha. All rights resevered. Designed by Templateism

Back To Top