From : https://gist.github.com/ankurk91/2efe14650d54d7d09528cea3ed432f6d
#Git branch in prompt.
git branch 2> /dev/null | sed -e '/^[^]/d' -e 's/ (.*)/ (\1)/'
export PS1="\u@\h \W[\033[32m]\$(parse_git_branch)[\033[00m] $ "
Want to find out more about these escaped codes and ANSI escape sequence color codes, here’s a good reference.
watch is a useful utility to execute a command on a timed basis, and exists in many Linux shells.
To install on MacOS with brew:
brew install watch
To repeat a command:
watch -n 1 somecommand
… to repeat the command every 1 second
The inevitable happened and while adding/removing some utils to my path, I messed up my .bash_profile and ended up with a PATH where I couldn’t run any commands.
To recover, the default PATH on MacOS should be:
dd is a pretty useful tool for creating and writing disk images from a source to a destination, for example writing disk .img files to SD Cards for your Raspberry Pi (see here, and here).
The trouble is if you’re writing images that are several GB that can run for 20mins or so, you don’t get any feedback on the progress until it’s complete. Well turns out if you send a ‘kill -INFO’ signal to the PID of the process, it will output the current status of bytes written and bytes remaining. Found this tip here.