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

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:
ABOVE: ESC= - List all options ESC* - Put all options on command line


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

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:

banner test > /dev/console


The following is another tool to troubleshoot amity connections — helps find out if the cable is plugged into the wrong port:

The most likely case is that the amity cable is plugged into the wrong serial port or wrong server (expansion port). We can look at the line settings:

Usage: get.line [ sysname | tty# | els# port# ]
c1amity: get.line pldi026

**** c1amity tty035814 ****
Settings: 9600,8,None,1
I/O: CD=1 DSR=0 CTS=1 RTS=1 DTR=1
An amity connection that is plugged into the wrong port may look like this:
I/O: CD=0 DSR=0 CTS=0 RTS=1 DTR=1

This is the serial equivalent of looking for a “link up” light on network connections.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.