User:Drue

test some more - this is a rubot test

Homebrew

 * /homebrew notes

Links

 * text mockup
 * Rosetta Stone for Unix

xterm

 * FreeBSD: "xterm -j -s +sb -sl 1000 -ls -geom 80x25 -bg black -fg green -cr orange -ms orange -hc darkblue -fa "clean*" -fs 11"
 * Linux: Use -fs 9

Changing a user's UID

 * manually change the UID using vipw (note the old UID)
 * change the user's GID to match in /etc/group (note the old GID)

The tricky part, then, is changing a user's files. This ought to do the trick: find / -user oldUID -print | xargs chown newUID find / -group oldGID -print | xargs chgrp newGID

FreeBSD Ports Index
cd /usr/ports make fetchindex portsdb -u
 * When you need to rebuild FreeBSD's Ports Index

Find Commands
find / -name \*.fo\? -exec ls -l {} \;
 * Basic Syntax

find. -type d -print0 | xargs -0 chmod a+r
 * Chmod has a +X option which will give dirs x but not files. I wanted the same thing for read, like a +R - here's a command that will do it.  It will give directories read access but not any files.

scp script
for file in `ls *.jpg` do scp $file tiger:~/bleh/ && rm $file done
 * Scp with sh example
 * 1) !/bin/sh

Bash
for foo in *.dist; do cp $foo `basename $foo .dist`; done
 * To rename all files in current dir without .dist extension (i think this only works in bash):

for z in *; do echo -n $z | sed 's/_/ /g' | perl -e '$_ = <>; chomp; print;' | xargs -0 mv $z; done
 * More complicated example

Serial
cu -s 9600 -l /dev/cuaa0 (or 38400) screen /dev/cuaa0 9600 vt100
 * To connect to a serial device.
 * 1) OR ##

drue@thermite:~$ cat .kermrc set line /dev/cua00 set speed 9600 set flow-control none connect drue@thermite:~$ kermit
 * Or using kermit:

Postfix + FreeBSD
In main.cf: alias_maps = hash:/etc/mail/aliases alias_database = hash:/etc/mail/aliases Then, newaliases to regenerate alias db.
 * Aliases with postfix in freebsd:

Command Line Perl
perl -pi -e 's/one/two/g' *.html find. | grep php | grep -v svn | xargs perl -pi -e 's/\$DOCUMENT_ROOT/\$\{_SERVER\[\"DOCUMENT_ROOT\"\]\}/g;'
 * To make a change to all files in a dir
 * recursively

perl -pi -e 's/[a-z]/[A-Z]/' *
 * Or how about setting the contents of everythign to lowercase

for x in *; do echo -n $x | tr A-Z a-z | xargs mv $x; done
 * This sets filenames in current directory to lowercase

FreeBSD Commands
sockstat -4
 * What's listening?

Apache Tips
12:43PM  Guys, patch this in all your httpd.conf's... Search for "IndexOptions FancyIndexing" and add a line after it that reads: 12:43PM     IndexOptions NameWidth=*
 * Apache truncating dir listings fix:

Cron Tips (freebsd)

 * Cron doesn't have a year option, nor is it possible to do, for instance, "first wednesday of the month". But, using date, you can do this:

Using Screen
Labeling Screens: In screen, ctrl-a :sessionname foobar Or start screen using -S and/or -t.