Cheat Sheet
This is common stuff that I always forget at the wrong moment, so I print this and put it on my wall at work.
shell :
To see what shell you are using (being in just “sh” explains a lot):
echo $SHELL
Make vi your command line editory:
set -o vi
Or, if you are still in sh, to switch to ksh and set vi as the command line editor:
ksh -o vi
crontab:
minutes(0-59) hours(0-23) dates(1-31) months(1-12) days(0-6)
* * * * * command
Set your backspace key to work:
stty erase BACKSPACE
(It may be you just need to switch how Putty is set up)
Set CTRL-Z to suspend job:
stty susp ^Z
Set other Terminal parameters:
stty rows 80
stty cols 25
export DISPLAY=vt100
Command line completion:
HPX: ESC\ or ESC ESC
SUN: ESC\
AIX: ESC\
ABOVE: ESC= - List all options ESC* - Put all options on command line
LNX: TAB
vi:
h - left
j - up
k - down
l - right
i – insert
a - append (A - append at end of line)
x - delete
X - backspace
0 - start of line (or is it ^ ?)
$ - end of line
b - back word
w - forward word
CTRL-H - backspace
/ - search
n - next instance
Other handy vi commands:
#g - go to line # of file
G - last line of file
o - open a line below me to type in
O - open a line above me to type in
u - undo
:1,$ s/4/john/g - from first line to last line of file, search for 4 and replace with john globally (all instances on the line)
yy - yank the line (copy)
dd - cut current line
p - paste (below) P - Paste (above)
:x! - (as ROOT) write and quit, even Read-Only files
Firefox:
F7 - Carret Browsing - select text w/ keyboard
/ - search
‘ - Search only links
Simple awk lines I always use but never remember:
awk ‘{ print $3 }’ = cuts column 3
awk ‘/dev/{print $2}’ = print /dev/ with column 2
c=’$'$n;awk “{print $c}” = print column $n
More awk stuff:
http://mattwalsh.com/twiki/bin/view/Main/AwkTutorial
banner test > /dev/console
