Byte Jar - Software Lessons Learned the Hard Way
A public service catalog of solutions to annoying software development problems, or
a sporadically updated rant chamber hosted by the code grunts of a tiny software company. Thanks for tuning in.
Getting the most out of your little prompt.
You don't need a heavy editor to create temporary files.
$ cat > EOTXT
Hello World
EOTXT
Using cat and heredocs, you can avoid creating temporary files.
$ (cat <<EOTXT ) | wc
> PO#61181 to GF/Boney for survey $5920 5/23/03-ktb
> PO# 59259 for assessment $22,408
> Amend #1 to PO 59259 for 908.00 wma 07/29/03
> PO #62840 Affiliated Engineers - Commissioning $37,000 wma 2/16/04.
> Amend #1 PO 61455 $11,880.00 wma 12/10/03
> Amend #2 PO6
> EOTXT
6 40 243
Want to know what's eating up all your drive space? Break out find:
# show me all local files (using ls -lh) that are bigger than 100 megabytes
$ find / -size +100000k -xdev -exec ls -lh {} \;
You can inject your public key into SSH's authorized_keys file using one easy command:
# from the machine you are on, to put your public key into the key file of user@host
# the first time run, this will require you authenticate as user@host.
# subsequent times will be password free.
# this requires you to use a Bourne-derivative and have GNU mkdir installed
cat .ssh/id_rsa.pub | ssh user@host "( [ -d .ssh ] && exit 0 || mkdir -m 600 .ssh ) && cat >> .ssh/authorized_keys && chmod 600 .ssh/authorized_keys"