Hacker News new | past | comments | ask | show | jobs | submit login

Me too, that's all there was. And that may be the answer: only allow yourself the command line for longer and longer periods of time. Force yourself to learn it.

I really like this book, even today: http://shop.oreilly.com/product/9780596003302.do

The key to being proficient at the command line (as distinct from writing shell scripts) is to think of it as composition.

For example, run this:

  $ file $(which $(man -k python | cut --delimiter " " --fields 1))
(The first '$' is your command line prompt, yours may differ; you don't type that. The other '$' characters you do type.)

Now run each command from the inside out, starting with the man command. See what each command does. Build it up bit by bit, that's exactly what I did, like this:

- the man command

- the man command piped into the cut command

- the man command piped into the cut command after reading "man cut" to remember about the --delimiter option

- the output of that pipeline fed to which

- the output of which fed to file

Note that I didn't use any for loops or variables, the shell did the right thing for me.

Read the man pages for each of those commands.

set -o vi or set -o emacs (or their equivalent in .inputrc) helps a lot when you compose things incrementally. esc-k k k (etc) is your friend if you set -o vi.

Read man bash. It will take you a long time. For today, read the section on READLINE. While in man bash, search for the word READLINE at the front of the line, like this:

/^READLINE

Slash = search

^ = anchor the search to the front of the line

READLINE = what you're searching for in the current man page.

For now, all you need in your ~/.inputrc file is:

set editing-mode vi

This will give you vi command line editing in bash, as well as any other program that uses readline, like the python REPL.

For more info on .inputrc,

  $ man readline
which is documentation for the C interface to readline, but is mostly about how readline is used by a user. For example, in man readline

/VI Mode bindings

gives you all your command line editing commands when you use vi mode.

Get a mostly table of contents of man bash, for your searching pleasure:

  $ man -P cat bash |egrep -v "^ " |egrep -o "^[^ ]+"
Sort it:

  $ man -P cat bash |egrep -v "^ " |egrep -o "^[^ ]+" |sort



And ...

I realized/remembered while reading the other comments that knowing what's available is a necessary part of "just use the command line a lot."

So try this, to get a good list of what's available (and for more command line composition)

  $ man -k $(ls -1 /usr/bin |egrep -v "\[") 2>&1 |egrep -v "nothing appropriate"
See if you can figure out what 2>&1 does (it's a very common idiom, probably easy to find), and figure out why it's needed here.

That's a long list of stuff, look at it a page at a time:

  $ man -k $(ls -1 /usr/bin |egrep -v "\[") 2>&1 |egrep -v "nothing appropriate" |less
That's still a lot of stuff, save it off in a file in your home directory for later:

  $ man -k $(ls -1 /usr/bin |egrep -v "\[") 2>&1 |egrep -v "nothing appropriate" > ~/wholelottacommands.txt




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: