bash shell tips

Useful shortcuts / structures in bash

* Ctrl-a: go to start of line      * Ctrl-c: kill foreground process      * Ctrl-d: logout      * Ctrl-k: cut (kill)

remainder of line (cf. emacs) * Ctrl-l: reset terminal * Ctrl-o: execute and retain history position * Ctrl-t: interchange last 2 chars (cf. emacs) * Ctrl-u: cut preceding portion of line (often used to clear line) * Ctrl-c: clear line (abandon command) * Ctrl-y: paste (yank) killed text (cf. emacs) * !: recall last history item starting with * #: comment...stick at start of long lines to `postpone' their execution *

!: a handy little trick for recalling history items without executing them * source foo.bar: source file

`foo.bar'. Replacing source with a dot . also works. * foo{bar,baz,...}: expands to foobar foobaz foo... * ${i%foo} expands to the value of variable $i, with the string "foo" chopped off the end * ${i#foo} expands to the value of variable $i, with the string "foo" chopped off the start * ${i/foo/bar} expands to the value of variable $i, with the string "foo" replaced by "bar"

There's plenty more that the bash shell is capable of, but I'll let you read the man page for that (that's man bash in case you were wondering!).