Tagged "bash"

Custom Colourful Bash Prompt

Bash, a command line shell is one of the most used pieces of software in my daily work. I like scripting repetitive actions to save a lot time (it brings me great joy!). One of the simplest and easiest customisations is to add a bit of colour to your otherwise boring bash prompt (otherwise known as $PS1): [ngrogan@localhost:~]$ can be turned in to this: The thing about Bash is the colour codes to achieve this can look archaic:

Output Percentage of File (Bash code)

I wrote this script recently for a friend in a job who needed to output a certain percentage of a log file, but no more and no less. This was in Linux using bash, so I had a go at writing a solution, which you see below. Posting this up in case it’s useful to anyone else! # !/bin/sh # Public Domain, by Neil Grogan 2010 # Script to output last 30% of file by lines OLDFILE="oldlog.