Eternal Bash History

Sometimes you need your bash history to store more than the default few hundred commands. Changing the

HISTSIZE

variable allows you to set the amount of lines you want to store in your history. There are a few other variables you can use to customise but you can find them Here

Changing HISTSIZE to an empty string will allow the history to go on and on and on….

# Eternal bash history.
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

RE: http://stackoverflow.com/questions/9457233/unlimited-bash-history

Ubuntu auto start ssh server

Having to setup an Ubuntu server recently, all the CentOS commands had to get thrown out the Window.
Before i could put the server into the rack i had to make sure sshd started if the server ever reset.
Below is the following command to add ssh to the default startup.

It actually updates the rc.d scripts so probably also adds shutdown scripts to the unneeded run levels

sudo update-rc.d ssh defaults

Bash Profile

I find myself working in iTerm a lot. Well to be honest i prefair a terminal over a Finder window any day.
So i find myself running the same commands over and over, {{ git status }} over and over to check if any files have changed.
Checking which branch i’m currently on.

I spent a lot of time altering my bash profile to enable colours by default, changing the prompt layout, setting up aliases etc.
I finally found a brilliant template online by Jacob Tomlinson at Terminal Piperita Theme

The prompt integrates into git, so if git is enabled in the current directory it will add the current branch to the prompt and tell me if there have been any changes made. It’ll give me the user my terminal is logged in as and the hostname of the machine along with the current folder all with some pretty colours that change if i am logged in as root too. Continue reading