vi commands

VI is an excellent text editor, I use it all the time when I'm logged into a server via Putty.

I'm more used to doing it in windows though, and recently I've been spending more time using a mac. The keyboard shortcuts are a bit different, or there are just less keys on this mac keyboard, so I've had to lookup a list of commands so I can type faster in vi!

So here's a link to a page listing loads of vi commands:

http://www.cs.fsu.edu/general/vimanual.html

I'll probably get around to making a page on the blog somewhere that's bit more concise than that page, as it's quite long, but it's still very useful and it has examples as well as the actual commands

Simple passwordless SSH tutorial

It took me many attempts to work out password-less ssh, mainly because a lot of internet guides are not written that well and following them step by step didn't work.

Then I found one that did work! Woohoo!

So I've copied and pasted it here... and regrettably forgotten the link I found it from. If anyone recognizes this then I'll gladly reference it to the correct source.

The guide makes use of local$ and remote$, this is to indicate if you are typing on your local or remote server.

Create the private key

view plain print about
1local$ ssh-keygen -t rsa (accept default file locations and create a password for your private key)
2local$ scp ~/.ssh/id_rsa.pub user@remote:/home/user/
3local$ ssh user@remote (enter normal root password)
4remote$ cat ~/id_rsa.pub >
> ~/.ssh/authorized_keys
5remote$ chmod 600 ~/.ssh/authorized_keys
6remote$ exit
7local$ ssh user@remote (at this point you shold be asked to enter the password for your private key)

Add private key password

The password for the private key needs storing in your machine. This is encrypted.
view plain print about
1local$ ssh-agent bash
2local$ ssh-add ~/.ssh/id_rsa
3local$ ssh user@remote (you should no longer be asked for a password)

Note: in the code examples above, don't type the stuff in brackets

Note 2: I think this was the blog I got the entry from, but it doesn't work any more so I can't be sure... I definitely looked there before I found it anyway: http://blogs.translucentcode.org/mick/archives/000230.html

Screens on Linux

I've recently started using screens when inside command line linux.

I got shown it by some Rackspace tech guys as I wanted to leave a process running after I'd left me shell.

Screens is brilliant, it lets you run multiple shells and allows you to switch between them with keyboard shortcuts, and you can close and reopen your ssh client (like putty) and all your "screens" are still there, so you can reconnect to them... or "attach" as screens calls it.

It's like having multiple terminal/putty windows open, except when you close the actual GUI window, the shell is still running.

What I've found this useful for is being logged into multiple GIT repositories and also having a couple of extra shell "screens" for database and server admin.

Anyway, this post is a little but rushed as I'm on my lunch and I've still not finished my super noodles, but use screens if you don't already and you use a command line linux server.

And I've put up a Linux section under my code reference, with a screens page in there...

Or I will do shortly... I'll link to the page in here once I've made it!