mh and xmh
He's a co-author of the classic UNIX Power Tools
Add'l ORA pubs:
"Power Tools" columns for Linux Magazine:
Though I've not read it specifically, From Bash to Z Shell seems likely to focus on shell art and arcana most closely.
His 1999 SVLUG talk was a classic, the slides don't give it justice, though there are some nuggets there for many users.
Python is slower compared to some of it’s compiled cousins, but it’s quick to write and a great skill to have when bash scripting can’t handle some of the complexity or you need dB access. We use it sometimes to call c programs to do DNA sequence alignments and process the returns.
For every command you run, assume there is a man page, and assume there is quick help, there usually and often are both.
$ man man # The man command has a man page about itself.
$ man -help # The man command has quick help.
A lot of this stuff is 40 years of accumulated and evolving conventions. Quick ref might not be available for a particular command, or might be found with -h, -help or --help.
Read the bash man page. Or whichever shell you're using, but if you haven't set it yourself it's probably bash.
The bash man page is pretty large, so don't read it all at once. Here's table of contents script that will give you a man page's table of contents. Make yourself a bin directory at /home/yourlogin/bin, then put it and other little tools that you write in there. Make them executable, and put that directory on your path. ("bin" is an old convention for "binary" or compiled programs. Ironically, most of what you put in there will not be binary. :)
$ cat ~/bin/toc
#! /usr/bin/env bash
if [[ $# == 2 ]]; then
man -S $2 -P "grep -E '^[^ ]'" $1
man -P "grep -E '^[^ ]'" $1
$ toc time
TIME(1) General Commands Manual TIME(1)
FORMATTING THE OUTPUT
$ toc time 2
TIME(2) Linux Programmer's Manual TIME(2)
Linux 2011-09-09 TIME(2)
$ man -S 2 time # As opposed to $ man time
$ man -k time # Show every man page title that has "time" in the tile or synopsis.
Learn about command history, and command line recall and editing
$ history # Shows all your recent commands.
http://bash.cumulonim.biz/BashPitfalls.html but don't worry too much about this yet, you have actual work to do instead. Just tuck it away for later.
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html same, later.
Learn about pipes, redirection and command substitution. https://duckduckgo.com/?t=lm&q=bash+command+substitution&ia=...
Use vim. Or emacs. But vim.
I use the urxvt terminal emulator. In my package repository it's called rxvt-unicode-256color. It has nice color support and unicode support, and a nice, very simple tab system.
Use tmux if you can, when/if you need it. My use of urxvt means I almost never need tmux (at home). I use it all the time at work, for its tab-like behavior. Most people who use tmux use it for its session management (I think).
Two good books:
Effective Computation in Physics http://shop.oreilly.com/product/0636920033424.do
It's a decent intro to Python, if you need/want that. But even if you don't care much about Python, or physics (I don't), it's also a decent introduction to how to use Unix to get shit done.
Unix Power Tools http://shop.oreilly.com/product/9780596003302.do
It's a door stop, but you can it it as an ebook (and all O'reilly digital products are DRM-free). Remember I said an accumulation of 40 years? It's all in here. I love this book.
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))
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:
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
/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 "^[^ ]+"
$ man -P cat bash |egrep -v "^ " |egrep -o "^[^ ]+" |sort
Keep it on your desk; read and apply a tool whenever you have a minute.
For more specific topics, look through the entire O'Reilly catalog. There is bound to be something there that covers at least part of what you want to learn. http://shop.oreilly.com/category/browse-subjects.do
For stuff that you do while you're doing something else, I really like Unix Power Tools. http://shop.oreilly.com/product/9780596003302.do
Get dozens of book recommendations delivered straight to your inbox every Thursday.