Geeks With Blogs
Greg Malcolm Everything but the Perl
I thought it was about time I imparted some actual information, instead of just reporting on where I've been, so here goes...


Suggestion #1: Quicker access to the Bash History with Ctrl+R

Bash Shell
Find your self constantly hitting up and down buttons when logged into a UNIX terminal, trying to locate the last command entered in the history for rebooting the cable modem, backing up the internet or shutting down the HAL 9000? There are much quicker ways to do it!

My personal favorite is hit Ctrl + R, then type a fragment of the command you are after. For example hit the keys Ctrl + R, s, and u and you've probably already found "sudo su - root".

You can also get a similar affect by prefxing a partial command with the '!' key. Only problem with that is you don't get a preview of what command you're running.


Suggestion #2: ssh -v (verbose mode) is your friend!

I was trying to connect to github for the first time with using public/private key access ealier, but it was rejecting my key. I was getting this when I tried to checkout some code:

Permission denied (publickey)
Great! So I tried the troubleshooting support webpages, and they suggested I test the connection through ssh. This gave me:

[gmalcolm ~]$ ssh git@github.com
Permission denied (publickey).

Yep, I'm locked out! I checked through a few more support threads, lots of people getting similar issues, but nothing that really applied to me. Until I finally remembered to take advantage of ssh's verbose mode:

[gmalcolm ~]$ ssh git@github.com -v
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [65.74.177.129] port 22.
debug1: Connection established.
debug1: identity file /c/Documents and Settings/gmalcolm/.ssh/identity ty
pe -1
.
.
.
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Documents and Settings/gmalcolm/.ssh/identity
debug1: Trying private key: /c/Documents and Settings/gmalcolm/.ssh/id_rsa
debug1: Trying private key: /c/Documents and Settings/gmalcolm/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

And there was it was! Apparently ssh was not looking where I expected for the private key. It just boiled down to the fact Git Bash (which I'm not that familar with) was using a slightly different flavor of ssh to the one I normally use, and verbose mode showed me what that difference was.
Posted on Tuesday, March 17, 2009 11:40 PM | Back to top


Comments on this post: Two random bash shell tips

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Greg Malcolm | Powered by: GeeksWithBlogs.net