Unix Toolbox

A look at some useful command line tools to enhance your terminal experience

Command Line Mystery

A while back, someone published the command line mystery, a whodunit that you investigate on the command line. I had a few hours to kill on a flight so I decided to work through it.

wiki

Wiki is a command line tool to fetch summaries from any Mediawiki wiki. By default, it searches the English language version of Wikipedia.

Rename a git branch

I can't count the number of times that I've created a new feature branch only to notice that I've managed to add a typo to the branch name. Usually, it looks something like this:

Special cron entries

There are some special entries that can be used when creating a crontab entry (crontab -e), most of which are just shortcuts for the standard crontab entries that we all know and love.

Git Push

If you've ever deleted a branch on a remote system only to have it recreated when you git push, this one's for you. It will make git only push the current branch by default; other branches are not …

git and diff-highlight

diff-highlight is a contrib script that ships with git. It's a better way to visualise a diff when the changes are small words, not entire lines/paragraphs. It's hard to explain, so here's an …

Enable zsh completion for "hub"

I just installed hub by GitHub, and wanted to enable the shell completion for ZSH that they provide. I had a few issues (due to a typo), so here's how to do it:

Working with Memcached via CLI

A lot of the time when I'm working on a project that uses memcached, I'll want to have a look at the data in the cache without using my application to make sure that it's doing what I expect. I …

The Unix Toolbox

This article originally appeared in the December 2013 issue of PHP Architect

A better git diff

Whitespace is like git diff's krypton, it makes changes that are actually tiny look much more complicated than they actually are. Thankfully, git comes with a few flags that you can use in …

jq - sed for JSON

I can't remember the last time a day went by that I didn't end up working with JSON data. It's a lovely format to work with, but unfortunately due to how verbose it is it can be quite difficult to …

Explain, from your shell

A few weeks ago, almost everyone on Twitter was sharing Explain Shell - with good reason. It's an awesome site that you can copy and paste a command into and it'll explain each component of it to you.

Vim Tips

I've been using vim for a while now, but with Vim being Vim, there's always new things to learn. Thanks to Jacek, I've learned a few more things recently.

Useful git commands

Git's a fantastic tool. If you know what you're doing, you can pretty much do anything that you can dream of.

ssh-add and SSH Forwarding

Anyone that's ever used SSH before will tell you how awesome it is when working with remote services. If you've never used it before, have a read and then come back to this.

A better git log

If you're working in a team with other developers, you probably use git log quite a lot to work out what's going on when you pull down new code. Whilst it works, it's not the greatest view of the …

Administering multiple ssh shells simultaneously with cssh

cssh is a tool that lets you administer multiple ssh sessions at the same time. Whilst it's not advised for production use, it's a huge timesaver for some common tasks.

Working with large files with sed

This week, I've been using sed quite a lot. sed is short for stream editor, and is designed to work with large amounts of streaming text.

sed

This week, I've been using sed quite a lot. sed is short for stream editor, and is designed to work with large amounts of streaming text.

.gitconfig

When working with git, there's quite a few different settings that you can set to change your experience. A lot of people know about the defaults of user.name and user.email for identification, but …

Mirror a directory with SCP

Another short one today, courtesy of Chris H.

extract

I'm not too sure where this one comes from, but I found it whilst working with Lorenzo at work. extract is a general purpose tool for uncompressing archives. No longer will you have to remember that …

pv | mysql

As a developer, I spend a lot of time importing backups generated with mysqldump into local mysql instances for testing. Most of the time

Weekly Breakdown - gxpr

Last week, we discovered gxpr. Using a script to make life easier is good, but understanding why it works is even better. Let's do a line by line breakdown of gxpr and try to understand how it works.

Bang Bang

Two quick terminal input manipulation commands today. The first is bangbang (!!). !! is a shortcut that means "substitute this with the last command run". It's most commonly used when you forget to s…

gxpr

Today's utility is a little bash script that searches Google and returns the value

z

z is a utility that allows you to jump around your machine very quickly. It allows you

cd -

A short one today. In keeping with the moving around theme from yesterday, I want to take a look at cd -. cd - means "take me back to the last directory I was in".

CDPATH

CDPATH is an environment variable that changes how the cd command works. Normally when you try and cd

GRC

GRC, or the "Generic Colouriser" is a utility that lets you run output through a script that adds colour via regular expressions. This doesn't sound too useful, but once you use it you'll never look …

ZSH config from scratch

I've been using ZSH for just over a year now, thanks to oh-my-zsh, but I realised that I probably wasn't using it to it's full potential. It's the same kind of thing as when I tried to use Vim, I …