Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Friday, February 12, 2010

Spelling and Dictionary Lookups at Bash Command Line

If you've ever wanted an easy way to look up a word in the dictionary, or spell check a word at the command line (in Linux), I've come up with a simple way to do it.

First, make sure you have aspell and curl installed, then simply paste the following functions into your .bashrc file:

function dictlookup
{
curl dict://dict.org/d:$1
}

function spellcheck
{
echo "$1" | aspell -a -c | grep "&"
}

Now you can do things like this:

> spellcheck antecedant

and:

> dictlookup antecedent

Enjoy!

Saturday, November 22, 2008

Bash Tab Completion

For all you Linux users out there, I just discovered something wonderfully useful at the Bash command line: tab completion suggestions. See this pic to get a better idea what I'm talking about:


For the above example, I typed "to", then hit the "tab" key. As expected, my computer beeped, indicating "hey, dummy there are a bunch of matches, how am I supposed to figure out which one you want?". To get a list of the possible matches, hit the "tab" key again. Then it prints out all of the available choices. Why hadn't I discovered this sooner?

Oh, and if you think my custom cursor is nifty, here's the line of code to put in your ~/.bashrc file:

PS1='\n================================\n\[\033[01;32m\]\h\[\033[00m\]:\n \[\033[01;34m\]\w\[\033[00m\]\n > '

I like having a nice separation between command outputs. It also gives me a double-clickable path (for quick copying), I never have to type "pwd" to remind myself where I am, and can quickly see which machine I'm logged into. Uber handy.