How to Christmassify Your Linux Terminal and Shell

It’s the most wonderful time of the year when the world is in the Christmas mood. It’s the happiest season of all. In this article, we will show some simple and fun Linux tricks to celebrate the season.

We will show how to christmassify your terminal and shell. By the end of this guide, you will learn how to customize your shell prompt using Bash variables and escaped characters.

In Bash, it is possible to add emojis, change colors, add font styles, as well as run commands that execute every time the prompt is drawn, such as to show your git branch.

Christmassify Your Linux Terminal and Shell

Christmassify Your Linux Terminal and Shell

Read Also: How to Customize Bash Colors and Content in Linux Terminal Prompt

To customize your Linux shell prompt to suit this Christmas festive season, you need to make some changes to your ~/.bashrc file.

$ vim ~/.bashrc

Add the following to the end of your ~/.bashrc file.

# print the git branch name if in a git project
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)//'
}
# set the input prompt symbol
ARROW="❯"
# define text formatting
PROMPT_BOLD="$(tput bold)"
PROMPT_UNDERLINE="$(tput smul)"
PROMPT_FG_GREEN="$(tput setaf 2)"
PROMPT_FG_CYAN="$(tput setaf 6)"
PROMPT_FG_YELLOW="$(tput setaf 3)"
PROMPT_FG_MAGENTA="$(tput setaf 5)"
PROMPT_RESET="$(tput sgr0)"
# save each section prompt section in variable
PROMPT_SECTION_SHELL="\[$PROMPT_BOLD$PROMPT_FG_GREEN\]\s\[$PROMPT_RESET\]"
PROMPT_SECTION_DIRECTORY="\[$PROMPT_UNDERLINE$PROMPT_FG_CYAN\]\W\[$PROMPT_RESET\]"
PROMPT_SECTION_GIT_BRANCH="\[$PROMPT_FG_YELLOW\]\`parse_git_branch\`\[$PROMPT_RESET\]"
PROMPT_SECTION_ARROW="\[$PROMPT_FG_MAGENTA\]$ARROW\[$PROMPT_RESET\]"
# set the prompt string using each section variable
PS1="
🎄 $PROMPT_SECTION_SHELL ❄️  $PROMPT_SECTION_DIRECTORY 🎁 $PROMPT_SECTION_GIT_BRANCH 🌟
$PROMPT_SECTION_ARROW "

Save the file and close it.

For the chages to start working, you can close and reopen your terminal window, or source the ~/.bashrc using following command.

$ source ~/.bashrc

This article originally appeared on ryanwhocodes website.

That’s all! In this article, we showed how to christmassify your terminal and shell in Linux. We showed how to customize your shell prompt using Bash variables and escaped characters. If you have any questions or comments, reach through the feedback form below.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.