unix

Tmux is great

Tmux is a great application with a few super-cool uses. You can get really deep into configuring it, but I tend to use the default options so that I can install it and start using it on any machine and get a similar experience. Here are a few of my favourite uses:

Persistent ssh sessions

This is far and away the best use of tmux. I typically use mosh to make sure my ssh sessions don't crash.

Use bash like a hacker

(Prepared to be shared at my work: www.uniqueway.com smiley)

Through long trial and error, and with a healthy dose of help from the Linux from Scratch website, I've accumulated some good knowledge of Bash in my time with Linux and OS/X. Here are the highlights:

squash-last-commit.sh

Sometimes you make a git commit, but there's a typo or syntax error in there by accident. I normally use git rebase -i HEAD~2 and then through the magic of vim I'm fairly productive at squashing the two commits together.

But wouldn't it be nice if there was a way to run one command to squash your most recent commit (which probably has a useless message like "typo" anyway) into the next most recent? Lucky for you, there is now!

Make mosh print the message of the day on Ubuntu 14.04

I'm running mosh 1.2.4 on my Ubuntu server, and it's always annoyed me that it doesn't print the message of the day (MOTD) on startup. ssh prints helpful information when you log in, like if you need to reboot or update packages, that I miss when logging in via mosh.

So you can imagine my surprise when I found out that this issue was fixed in version 1.2 of mosh, 4 versions ago!

Copy ssh key in one command

This is absolutely brilliant

cat .ssh/id_rsa.pub | ssh remoteserver.example.com 'cat >> .ssh/authorized_keys'

All credit to Matt Might

Working more efficiently with rails migrations

I've been working on a major schema refactor on a rails application recently, and time and again I've had to reset my database because of some syntax error or another in my migrations. I'm changing schemas and moving data between columns, which makes the migrations really fragile.

It's also been fun learning about the rake tools that allow you to manage database migrations. In particular, three rails commands have come in handy:

Subscribe to RSS - unix