[[misc]]
 

Eterm

Eterm -b black -f white -l --buttonbar off -x --overstrike-bold -O --tint blue --font-fx none

in .Eterm/themes/Eterm/user.cfg

being toggles
   scrollbar 0

Screen

  • ctrl-a-esc - Scrollback
  • ctrl-u - Scroll up 1 page
  • ctrl-d - Scroll down 1 page
  • ctrl-a-S - Split screen
  • ctrl-a-tab - Switch between splits
  • ctrl-a-X - Kill Split.

Broken high ASCII Support

export TERM=vt100
export LANG=C

Passwordless SSH

To ssh without a password.

On the Client:

mkdir -p ~/.ssh
chmod 0700 ~/.ssh
ssh-keygen -t dsa -f ~/.ssh/id_dsa -P '' 

Copy ~/.ssh/id_dsa.pub to the server, and append it to ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2. You should then be able to ssh without a password.

SSH Keep Alive

Add the following to your ~/.ssh/config file:

Host * 
    ServerAliveInterval 120
    ServerAliveCountMax 3

Breaking RCS Locks

rcs -u hosts
rcs -l hosts
ci -u hosts
co -l hosts
vi hosts
ci -u hosts

Regular Expressions and one-liners

Pipe your email through the following and you can separate the headers from the body.

grep -n -E "^$" | head -1 | cut -d: -f1 

Run every jpeg in the current directory through convert to compress it. (Handy for the jpegs that iPhoto creates for webpages):

for i in *.jpg ; do convert $i $i.new ; mv $i.new $i ; done

Indent the next 8 lines in vi:

8>>

Delete all the src directories under the current directory:

find . -type d -name src -exec rm -r {} \;

Run a command 100 times (when you have seq available)

for i in `seq 1 100` ; do echo $i ; done

Bold Text

bold=`tput smso`
offbold=`tput rmso`
echo "${bold}You must be the \"root\" user to run this script.${offbold}"

For each day in the current month, print the “Day " and then the date.

cal -m | tail -6 | awk '{for (i=1;i<=NF;i++) print "Day " $i}'

Print the last field from a string

echo "foo bar baz" | awk '{print $NF}'

Make Crypt passwords for use in LDAP

perl -e 'print("userPassword: {CRYPT}".crypt("password","salt")."\n");'

Print all fields in a line, except the first

awk '{for (i=2;i<=NF;i++) print $i}'

Append text only to certain lines

awk '{if ($1 == "kernel") print $0 " noht noapic" ; else print $0}' /etc/grub.conf > /etc/grub.conf.new
  for i in jim-smith bob-jones; do
    echo $i | ( IFS=- read fore sur; echo fore=$fore sur=$sur )
done

Who needs a mail client for sending mail?

(echo HELO `cat /etc/nodename` && sleep 1 && echo MAIL FROM: \
your@address && ... && uuencode foo.tar.gz foo.tar.gz) | nc `host \
-t mx foo.co.uk | head -1 | awk '{print $7}'` 25 
 
misc.txt · Last modified: 2006/10/02 12:19 by gavin
 
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki