Display a cool quote/message with each terminal session

Gd’day Folks.

In addition to setting my browser homepage to show a random (and often interesting) wikipedia page upon launch – I have made some tweaks in my daily workflow to ensure that I am greeted with interesting factoids and knowledge from around the globe whenever I open up a browser or – as I will briefly show you today: our good old terminal.

In order to make this happen, you will need to:

1.) Install fortune – which essentially displays amusing quotes from a database (which itself is editable for your own additions in the future). This might vary based on your distribution. Just search around your package manager. (pacman, apt-get, portage etc.) If you are using Arch, it’s basically: pacman -S fortune

2.) Install figlet – this is optional – but recommended if you want to be l33t and cool. It will serve us by making our text much more appealing than its default state.

3.) Edit ~/.bashrc to include the following:

# Lapbox ~/.bashrc file
# Last Modified 26 February 2008
# Running on Arch Linux - Greymask
# Credit to Lenny for the original ~/.bashrc
# Colors:


# Aliases:

## make ls list by size
##alias ls='du -s */* | sort -n'
alias findbig='find . -type f -exec ls -s {} ; | sort -n -r | head -5'
alias ports='netstat -nape --inet'
alias steves='ssh -p XXXXXX XXXXXXXXXXXX'
alias 150='ssh -l founder -p XXXXXX XXXXXXXXXXXX'
alias ping='ping -c 4'
alias ns='netstat -alnp --protocol=inet'
alias search='aptitude search'
alias ls='ls -F --color=always'

# Functions and Scripts:

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth


localnet ()
ifconfig | awk '/inet / {print $2}'

upinfo ()
echo -ne "${cyan}$HOSTNAME ${cyan}uptime: ${cyan} ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
## if [ -n "$1" ]; then
##    builtin cd "$@" && ls
##  else
##    builtin cd ~ && ls
##  fi

encrypt ()
gpg -ac --no-options "$1"

decrypt ()
gpg --no-options "$1"

if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*) echo "'$1' cannot be extracted." ;;
echo "'$1' is not a file."

# Some default .bashrc contents:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
#PS1='${debian_chroot:+($debian_chroot)}[\033[01;32m]u@h[\033[00m]:[\033[01;34m]w[\033[00m]$ '

# Prompt:

PS1='[e[1;32m]u[e[m] [e[1;34m]w[e[m] [e[1;32m]$[e[m] [e[1;37m]'

# System Information:

echo -e "${darkgray}";figlet "HI JOHN DOE";
echo -ne "${cyan}Today is: ${cyan}" `date`; echo ""
echo -e "${lightgray}"; fortune
#echo -e "${cyan}Kernel Information: t${cyan}" `uname -smr`
#echo -ne "${cyan}";localnet;echo ""

This is the result of the above listed ~/.bashrc file

Arch Linux Quote on Terminal Session Fortune

Nifty huh? I have mine greet me with my name since I am such a narcissistic bastard, but you can pretty much do anything you want. If you look carefully, the last screenshot also shows the “current” day and time along with a quote pulled from fortune. Also, if you notice, there are A LOT more additional options included in my ~/.bashrc so feel free to uncomment/comment things out and modify it till you are happy with the setup.

Tags: , , , ,

Leave a comment..

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