I spin up new terminal sessions countless times a day.
So one day, I decided that it needed to look more lively.
I ended up throwing some ASCII arts and messages generated conditionally based on the time of the day into the the startup profile of the shell. Now, if you are used to the UNIX systems, you already know it’s a no brainer.
But every now and then I get asked how this is set up, so here’s how.
Steps
First, find out what shell you are using. This helps to locate the startup profile of the shell. You can do this by running echo $SHELL
in your terminal.
If you are on zsh
, you can edit .zlogin
(location: ~/.zlogin
), or other startup files like .zshenv
. See this post for differences.
If you are on bash
, you can edit .bash_profile
.
Once the file is located, open the file with a text editor of your choice and start editing. Here’s the script used for the screenshot above:
# get the current hour
h=`date +%H`
# if hour < 12
if [ $h -lt 12 ]; then
echo "
GOOD MEOW-NING ^.^
▄▀▄ ▄▀▄
▄█░░▀▀▀▀▀░░█▄
▄▄ █░░░░░░░░░░░█ ▄▄
█▄▄█ █░░▀░░┬░░▀░░█ █▄▄█
"
# else if hour < 18
elif [ $h -lt 18 ]; then
echo "
GOOD AFTERNOON ^.^
▄▀▄ ▄▀▄ )) \___/_ Have some
▄█░░▀▀▀▀▀░░█▄ |~~| /~~~\ \ afternoon coffee
▄▄ █░░░░░░░░░░░█ ▄▄ C|__| \___/ maybe?
█▄▄█ █░░▀░░┬░░▀░░█ █▄▄█
"
else
echo "
(~\ _
\ \ / \
\ \___/ /\\
| , , | ~
( =v= )
' ^ ' GOOD EVENING
"
fi
For ASCII arts, you can use online generators or tools to create your own.
Once done, source the file or open a new session to see the effect.
Final Word
Editing the startup profiles to echo content to stdout is an extremely simple/quick trick to throw in some fun (or just be a little extra some days :D) when you start up the terminal.
Additionally, I also use Oh My Zsh for more stylings and plugins. If you’re a terminal person, check them out!