Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vade [2017/03/22 ]
adam
vade [2020/05/16 ] (current)
adam
Line 1: Line 1:
 +~~REDIRECT>https://adam.nz/vade/~~
 ====== Vade Mecum == ====== Vade Mecum ==
- 
 <WRAP right box round 300px> <WRAP right box round 300px>
 When I was learning Unix in the early nineties I struggled with the syntax of commands at the console. To help myself learn, every time I "discovered" a new command, I'd record it so I had a known good starting point the next time I needed something similar. For years I kept it as a text file in ~/etc, but when I discovered wiki's I moved it to a wiki page so I could more easily get to it from anywhere. When I was learning Unix in the early nineties I struggled with the syntax of commands at the console. To help myself learn, every time I "discovered" a new command, I'd record it so I had a known good starting point the next time I needed something similar. For years I kept it as a text file in ~/etc, but when I discovered wiki's I moved it to a wiki page so I could more easily get to it from anywhere.
Line 9: Line 9:
  
 <code> <code>
-vade () { curl --silent http://adam.nz/vade?do=export_raw grep $1 | awk 'BEGIN {FS="</?(code|WRAP|WRAP indent)>"} /ode><WRAP/ {print $2"\n\t-- "$4}' | egrep -i --color "(${1}|$)"; }+vade () { curl --silent "http://adam.nz/vade?do=export_text" egrep -v "(^ *$)" | egrep -A 1 "^#.*(${1}).*$"; } 
 </code> </code>
  
Line 21: Line 22:
 </WRAP> </WRAP>
  
-<WRAP hide> +{{namespace>:vade&rsort&nofooter}}
-<code></code><WRAP indent></WRAP> +
-</WRAP> +
- +
-<code>flaunt() egrep --color "($1|$)"; }</code><WRAP indent>Bash function (eg. for ~/.bash_profile) to highlight any matching text.  Usage: ls -d /etc/pa* | flaunt pass </WRAP> +
- +
-<code>curl -s elasticsearch.spack.org:9200/_cluster/health | python -m json.tool</code><WRAP indent>Retrieve cluster health from an Elastic Search node and pretty print the JSON result using Python.</WRAP> +
- +
-<code>defaults write com.apple.Safari IncludeInternalDebugMenu 1</code><WRAP indent>Enable the Debug menu in Safari.  You can use "Debug – Media Flags – Disable Inline Video" to [[http://www.kirkville.com/stop-auto-play-videos-from-annoying-you-in-your-browser/|stop vides from autoplaying]].</WRAP> +
- +
-<code>pip install jupyter --user python </code><WRAP indent>Install the Python package Jupyter using PIP.  This works even though jupyter has dependencies which require upgrading the builtin macOS setuptools (which aren't upgradable because of SIP). </WRAP> +
- +
-<code>gpg --armor --export adam@shand.net | pbcopy</code><WRAP indent>Export my GnuPG public key and add it to the paste buffer (so I can cmd-v it somewhere else).</WRAP> +
- +
-<code>sudo easy_install pip</code><WRAP indent>How to best install PIP on macOS.</WRAP> +
- +
-<code>wget --quiet  -O - http://www.drivelive.nz/kapiti | hxclean | hxselect div#62.toggle-table | hxselect -ic span.time-text | hxremove i | awk -v W=13 -v P=14 '{print $W", "$P}' </code><WRAP indent>Download a web page to stdout, select only the HTML within the div with id "62.toggle-table", print the content within the spans with a class of "time-text", remove all the italics elements and print out the 13th and 14th items on the remaining text list.</WRAP> +
- +
-<code>wget --quiet  -O - http://www.drivelive.nz/kapiti | hxclean | hxselect div#62.toggle-table | hxpipe | awk -F\- '/[0-9]mins / {print $2}+
-</code><WRAP indent>Download a web page to stdout, select only the HTML within a particular div and then convert the HTML to an easier format to use awk on.</WRAP>+
  
-<code>wget --quiet  -O - http://www.drivelive.nz/kapiti | hxnormalize -x | hxselect div#62.toggle-table | hxaddid span.time-text | hxselect -ic span.time-text | hxprune -x -c "" | hxselect -ic p</code><WRAP indent>Download a web page to stdout, number all the spans with a class of "time-text" and pull out the text within the span's with a class of "time-text"</WRAP> 
  
-<code>find . -name "*jpg" -size +1M -exec mogrify -geometry 1024x1024 {} \;</code><WRAP indent>Find all files ending in *jpg which are greater than 1MB in size and resize them so that the longest dimension is 1024.</WRAP> 
-<code>zip -r /tmp/backup.zip web/</code><WRAP indent>Recursively zip the contents of web/* into a file called backup.zip</WRAP> 
-<code>find uploads -type f | zip /tmp/uploads.zip -@</code><WRAP indent> Zip the list of files that come from standard in. </WRAP> 
-<code>awk 'BEGIN {FS="/?(code|WRAP>)" {print $0}' </code><WRAP indent> Sets the field delimiter (same as awk -F) to a regular expression which matches ''code>'' or ''/code>'' or ''WRAP>'' or ''/WRAP>'' </WRAP> 
-<code>egrep --color "(foo|$)" </code><WRAP indent>Passes through all lines (doesn't filter anything out) but colors any instance of "foo".</WRAP> 
-<code>( echo quit; sleep 1 ) | telnet localhost 25</code><WRAP indent>Ghetto expect script, types "quit" once you've connected to port 25 of localhost. </WRAP> 
-<code>( echo 131d; echo wq ) | ex ~/.ssh/known_hosts</code><WRAP indent>Delete line 131 from the known_hosts file. </WRAP> 
-<code> /usr/platform/sun4u/sbin/prtdiag -v</code><WRAP indent> Prints hardware info </WRAP> 
-<code> 2>&1 (or &>)</code><WRAP indent> (Ba|k)sh redirect stderr to stdout </WRAP> 
-<code> :(){ :|:& };:</code><WRAP indent> A Bash fork bomb.   Unless per user resource limits are in place (eg. ulimit -u 100) it will DOS a machine. </WRAP> 
-<code> :g/^ *$/+1 s/^ *[^ ]/&lt;p>&/</code><WRAP indent>  [vim] Put a &lt;p> at the beginning of every paragraph </WRAP> 
-<code> :set fileformat=unix</code><WRAP indent> [vim] Converts DOS end of line markers to Unix style </WRAP> 
-<code> <div align=right>last updated 08 may 2000</div></code><WRAP indent> Aligns text on the right side </WRAP> 
-<code> <meta http-equiv="refresh" content="5; URL=http://www.spack.org/"></code><WRAP indent> Redirect browser to www.spack.org after 5 seconds </WRAP> 
-<code> >&</code><WRAP indent> [T]csh redirect stderr to stdout </WRAP> 
-<code> Acquire::http::Proxy "http://ipofproxyserver:port";</code><WRAP indent> apt.conf line for apt through a proxy. </WRAP> 
-<code> CpMac -pr /Applications/iPhoto /Users/adam/Applications</code><WRAP indent> [mac] Copies the iPhoto directory correctly with all resource forks and meta data preserved (requires the developer tools to be installed and you need /Developer/Tools in your path). </WRAP> 
-<code> GRANT ALL PRIVILEGES ON "*.*" TO "root"@"%" IDENTIFIED BY "YoMama";</code><WRAP indent> Grants all permissions to all tables of all databases inside a MySql server to the user "root" from any host. </WRAP> 
-<code> MvMac /Applications/iPhoto /Users/adam/Applications</code><WRAP indent> [mac] Moves the iPhoto directory correctly with all resource forks and meta data preserved (requires the developer tools to be installed and you need /Developer/Tools in your path). </WRAP> 
-<code> SetFile -a V /foo/bar/</code><WRAP indent> [mac] Make folder /foo/bar invisible.</WRAP> 
-<code> medusa.xtra.co.nz, you must use the 6 digit Xtra number with a 01 at the end of it</code><WRAP indent> How to POP mail off Xtra </WRAP> 
-<code> at&f1x2&h1&r2&b1s27=48 </code><WRAP indent> Good US Robotics modem init string </WRAP> 
-<code> ats56=128S27=48S28=100 </code><WRAP indent> US Robotics modem init string, solves: CONNECT 28800/V34/NONE </WRAP> 
-<code> Internet History.{FF393560-!C2A7-11CF-BFF4-444553540000} </code><WRAP indent> Create this folder under "C:\Windows\Start Menu", this will create a folder which shows all the IE URLS visited. </WRAP> 
-<code> airport --scan</code><WRAP indent> [mac] Prints out the relevant info for all the currently available wireless access points (essid, encryption, channel, signal, bssid etc).  There are other useful options as well (-x gives the output in XML) but the command lives in /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources so add it too your path or link it somewhere. </WRAP> 
-<code> append = "floppy=thinkpad apm=on"</code><WRAP indent> lilo command for apm support with default debian kernel </WRAP> 
-<code> append = "mem=128M"</code><WRAP indent> lilo command for forcing memory detection </WRAP> 
-<code> append="ether=12,0x300,eth0 ether=15,0x340,eth1"</code><WRAP indent> sample lilo config </WRAP> 
-<code> apt-cache search pgp</code><WRAP indent> searches for packages called pgp </WRAP> 
-<code> apt-cache show ssh</code><WRAP indent> prints package info </WRAP> 
-<code> apt-get --compile source <packagename></code><WRAP indent> downloads, compiles and installs </WRAP> 
-<code> apt-get -d install ssh</code><WRAP indent> just downloads package </WRAP> 
-<code> apt-get update; apt-get dist-upgrade</code><WRAP indent> upgrade debian </WRAP> 
-<code> awk '/DAILY/ {x=$0;next } {print x,$0}'</code><WRAP indent> Puts line matching /DAILY/ into $x, then skips to the next line and prints $x followed by the next line.  Useful for generating reports when each log entry spans two lines.  Eg. line 1 and 2 get merged into line 1, and line 3 and 4 get merged into line 2 etc. (from Shannon) </WRAP> 
-<code> awk '/searchfor/ {print}'  or  awk '!~/don'tsearchfor/ {print}'</code><WRAP indent> How to do searches with awk. </WRAP> 
-<code> awk '\!/^#|^$/ {print $1}' virtusertable </code><WRAP indent> Print lines which don't start with a # or aren't an empty line </WRAP> 
-<code> awk '{ if (($1<=2103) && ($2>=2103)) print $0}' findit4</code><WRAP indent> blah </WRAP> 
-<code> awk '{i++$3} END {print i}' checkers.sep22</code><WRAP indent> How to do "wc -l" with awk? </WRAP> 
-<code> awk -F, '{if (/\@/) {print $1} else {print $1"@alaska.net"}}' /tmp/xmascard</code><WRAP indent> blah </WRAP> 
-<code> awk '{printf "%-30s\t%s\n", $1,$2}'</code><WRAP indent> Prints $1 in a left justified 30 column wide field, then a tab, then $2. </WRAP> 
-<code> boot: linux init=/bin/bash </code><WRAP indent> to get to root without the root password </WRAP> 
-<code> boot: linux root=/dev/hda1 emergency</code><WRAP indent> To get a prompt off the rescue disk </WRAP> 
-<code> cadaver -t idisk.mac.com/adamshand</code><WRAP indent> Connect to your Apple iDisk via a WebDav commandline tool (available via Fink). </WRAP> 
-<code> cat /var/spool/mail/luser | formail -s sendmail -oi luser@new.address</code><WRAP indent> blah </WRAP> 
-<code> cat spoolfile | formail -s procmail</code><WRAP indent> splits to single message for handling by procmail </WRAP> 
-<code> cat spoolfile | formail -s sendmail -v -t -odq </code><WRAP indent> resends mail. </WRAP> 
-<code> catman -w -M <man-page-directory></code><WRAP indent> rebuilds catman index under solaris </WRAP> 
-<code> cd /usr/share/ssl/certs; make slapd.pem</code><WRAP indent> Make a self-signed certificate for slapd (see OpenSsl for long way). </WRAP> 
-<code> cd /var/lib/mailman; rm archives/public/listname; bin/arch listname</code><WRAP indent> this will rebuild the archives </WRAP> 
-<code> cd /var/mail; for i in *; do echo cat $i | formail -s sendmail -v -oi $i@spack.org; done</code><WRAP indent> When mail gets delivered on the wrong server due to a sendmail.cw mess up this is a life saver.  For every file in /var/mail it feeds the file to formail (part of procmail), which then feeds splits the file into seperate email messages and feeds them into sendmail one at a time.  Sendmail only delivers the mesesage to the person listed on the commandline but leaves the headers of the message intact so it appears corrrect to the user when it arrives. </WRAP> 
-<code> cd sourcedir ; tar cf - . | (cd targetdir; tar xvpf - )</code><WRAP indent> Moves data from sourcedir to targetdir using tar to preserve permissions etc. </WRAP> 
-<code> certtool i newrootcert.crt k=X509Anchors</code><WRAP indent> [mac] Adds newrootcert.crt to ~/Library/Keychains/!X509Anchors, very useful for adding non-standard root certificates (ie. CaCert).  This makes changes effective for your user.  To make changes take effect globally you should copy /System/Library/Keychains/!X509Anchors to ~/Library/Keychains/, run certtool and then copy it back.  Remember to restart applications for changes to take effect ([[http://tirian.magd.ox.ac.uk/~nick/openssl-certs/others.shtml#ca-osx| more information]]). </WRAP> 
-<code> chvt 1</code><WRAP indent> force change to virtual terminal 1 (good way to exit X before suspending) </WRAP> 
-<code> ci -t/dev/null -u *</code><WRAP indent> Check in all files in the current directory with no message (saves being prompted for a message for each file). </WRAP> 
-<code> co -r1.6 -l script.pl</code><WRAP indent> Restore version 1.6 of RCS controlled file script.pl </WRAP> 
-<code> convert filename.jpg iptc:-</code><WRAP indent> Print IPTC data from filename.jpg to standard out. </WRAP> 
-<code> convert source.jpg -thumbnail '100x100>' -bordercolor white -border 50 -gravity center -crop 100x100+0+0 thumb.jpg</code><WRAP indent> Converts source.jpg to a square thumbnail 100x100 (if the image was not square to start with then the top/bottom or left/right is padded with a white border). </WRAP> 
-<code> cpu -w usermod -c "Adam Shand" -s /bin/bash adam</code><WRAP indent> CPU is a LDAP aware clone of the user/add/mod/del commands, -w means prompt for the password on the command line and the rest of the arguments are very similar to user* tools.  The majority of the config can go into /etc/cpu.conf </WRAP> 
-<code> curl -C - -O http://rudix.googlecode.com/files/gettext-0.17-6.dmg</code><WRAP indent> Download the file to a local name which matches the remote name, and if the download is interupted figure out automatically the offset at which to resume. </WRAP> 
-<code> curl -B "ldap://ldap.spack.org/dc=spack,dc=org??sub?uid=adam"</code><WRAP indent> Prints the results of a sub search for any entry which matches "uid=adam" </WRAP> 
-<code> curl -B "ldap://ldap{1,2}.spack.org/dc=spack,dc=org??sub?uid=adam"</code><WRAP indent> Queries ldap1 and ldap2.spack.org and prints the results of a sub search for any entry which matches "uid=adam" </WRAP> 
-<code> curl -B "ldap://ldap.spack.org/dc=spack,dc=org?uid?sub?(uid=*a*)"</code><WRAP indent> Prints out the uid of any entry which as uid value that matches "*a*". </WRAP> 
-<code> date --date "30 mins ago" </code><WRAP indent> prints date thirty minutes ago </WRAP> 
-<code> date --date "7 days" +%s</code><WRAP indent> Prints the date 7 days from now in unix time (could also do --date "7 days ago"). </WRAP> 
-<code> dd if=/dev/zero of=/dev/hda bs=446 count=1</code><WRAP indent> Clear the MBR (master boot record) of /dev/hda without harming the partition table (change 446 to 515 to delete the MBR and the partition table). </WRAP> 
-<code> dd if=/dev/zero of=/tmp/file bs=1024 count=2048</code><WRAP indent> Create a 2MB file by pumping 2048 1k blocks into /tmp/file. </WRAP> 
-<code> dd if=/tmp/rescue.bin of=/dev/fd0 bs=512 </code><WRAP indent> to copy a disk image onto a floppy </WRAP> 
-<code> defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES</code><WRAP indent> Show full path in Finder window. </WRAP> 
-<code> defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'; killall Dock</code><WRAP indent> [mac] Configures [[http://www.macosxhints.com/article.php?story=20071101055329470 |a new dock item]] which allows you to see recent apps/docs/volumes/servers or favorite items in a stack.  You can run it multiple times to get multiple icons. </WRAP> 
-<code> defaults delete com.apple.Terminal FocusFollowsMouse</code><WRAP indent> [mac] (panther) Revert focus follow mouse back to normal off setting by deleting the change. </WRAP> 
-<code> defaults write -g NSUmask 18</code><WRAP indent> [mac] Change the default umask for a user (effects finder and everything), "18" is "022" in decimal so remember to do the octal/decimal conversion. </WRAP> 
-<code> defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin true</code><WRAP indent> [mac] Keeps drives mounted after logout and before login. </WRAP> 
-<code> defaults write com.apple.mail MinimumHTMLFontSize 18</code><WRAP indent> [mac] Set a minimum font size for HTML email messages in Mail.app (from [[http://www.hawkwings.net/2005/10/27/setting-a-minimum-html-font-size/ |Hawk Wings]]) </WRAP> 
-<code> defaults write /Library/Preferences/com.apple.loginwindow LoginHook /path/to/script.sh</code><WRAP indent> [mac] Runs script.sh (as root) every time a user authenticates to the Login Window (see Bombich for more [[http://www.bombich.com/mactips/loginhooks.html |details]]). </WRAP> 
-<code> defaults write com.apple.Terminal FocusFollowsMouse -string YES</code><WRAP indent> [mac] (panther) Set focus follow mouse for your terminal windows. </WRAP> 
-<code> defaults write com.apple.iPhoto AskHotPlugAction true</code><WRAP indent> [mac] Make iPhoto ask if it should open automatically when media is inserted (can also be changed via Image Caputure's preferences) </WRAP> 
-<code> dh-make-perl --build --cpan Mail::Audit</code><WRAP indent> Download from CPAN and build deb package of Perl module </WRAP> 
-<code> dig spack.org axfr @localhost</code><WRAP indent> how to get a zone transfer from a server with dig </WRAP> 
-<code> dig @a.root-servers.net . ns > /etc/bind/db.root</code><WRAP indent> Update Bind's root hints file in Debian. </WRAP> 
-<code> diskutil info disk0</code><WRAP indent> [mac] Shows harrdware information on  the primary disk. </WRAP> 
-<code> diskutil disableJournal /Volumes/iShand</code><WRAP indent> [mac] Disables the HFS+ journal on the device mounted at /Volumes/iShand (in this case my iPod so it can be mounted up under Linux).  You can do this with the GUI "Disk Utility" applicaiton as well but it's a hidden option, hold down option before clicking the "File" menu and you will see an option to disable the journal. </WRAP> 
-<code> ditto --rsrc -V foo/ /backup/foo</code><WRAP indent> [mac] Copy the contents of foo to another directory, preserving resource forks by copying them to {{{._*}}} files.  Very useful for backing up AppleOsx files to a non-Mac NFS server. </WRAP> 
-<code> ditto --rsrc -v -c -z foo/ /backup/foo.cpio.gz</code><WRAP indent> [mac] Recursively copy the contents of WorkPace.app and the resource forks into a compressed CPIO archive. </WRAP> 
-<code> dns-sd -B _workstation._tcp</code><WRAP indent> [mac] Uses mDNS to get a list of all machines on the current subnet. </WRAP> 
-<code> dscacheutil -flushcache</code><WRAP indent> [mac] (Leopard) Flushes the DNS cache so you can pick up changes (before Leopard was lookupd).   </WRAP> 
-<code> dpkg --ignore-depends</code><WRAP indent> eg. if you manually make apache and then want to install a debian package which requires apache </WRAP> 
-<code> dpkg --set-selections hold 'filename'</code><WRAP indent> puts a package on hold </WRAP> 
-<code> dpkg-repack wterm</code><WRAP indent> builds wterm_xxx.deb from installed files </WRAP> 
-<code> dpkg-scanpackages . /dev/null | gzip -c > Packages.gz</code><WRAP indent> Create a Packages.gz file </WRAP> 
-<code> dpkg-reconfigure --priority=low debconf</code><WRAP indent> Reconfigure a Debian system to ask you any configuration a package may want to know (by default it only asks you important questions) </WRAP> 
-<code> du -sk * | gawk '{ i=i+$1; print i"\t ["$1"] "$2 } END {print "total\t"i}'</code><WRAP indent> Run du with a cumulative space total. </WRAP> 
-<code> dump 0f - / | ( cd /new ; restore rf - ) </code><WRAP indent> copies one disk to another </WRAP> 
-<code> e2label /dev/hda1 /foo</code><WRAP indent> Labels /dev/hda1 as "/foo" which can then be used instead of the raw device in /etc/fstab to label things.  Without the label name it prints out the value of any existing label. </WRAP> 
-<code> echo "FOO"  > /dev/fd/2</code><WRAP indent> Output FOO to stderr (standard error). </WRAP> 
-<code> echo "aes: inital checkin" | ci -u foo.txt</code><WRAP indent> Checks in foo.txt using the contents of the echo for the log message. </WRAP> 
-<code> echo "foo bar baz" | sed 's/^.*bar \(.*$\)/\1/'</code><WRAP indent> Only prints what is after "bar " (so just outputs "baz"). </WRAP> 
-<code> echo "foo bar" | perl -pe 's/foo/BAZ/'</code><WRAP indent> Takes standard in (from echo in this case) and replaces all instances of "foo" with "BAZ". </WRAP> 
-<code> echo "foo" | ssh ronin.spack.org "cat > /tmp/foo.txt"</code><WRAP indent> Creates a file on ronin called /tmp/foo.txt with the contents of standard in using SSH as transport. </WRAP> 
-<code> echo -e "F A I L E D  to push nis files to ${desthost}" >&2</code><WRAP indent> writes to stderr </WRAP> 
-<code> egrep -v "^(#| *$)" /etc/syslog.conf  </code><WRAP indent> gets rid of all comment lines or blank lines </WRAP> 
-<code> enscript -i4 -r -2 filename   </code><WRAP indent>      (ascii --> postscript 2 pages/page) </WRAP> 
-<code> exportfs -i -v -o anon=0 /</code><WRAP indent> [netapp] Gives everything mount rw/root perms </WRAP> 
-<code> fdisk /mbr</code><WRAP indent> Reset the MBR (master boot record).  This doesn't clear the MBR it restores it to a factory default (or something like that??). </WRAP> 
-<code> fetchmail -c -u larry alaska.net      </code><WRAP indent> checks (but does not retrieve or delete messages for larry@alaska.net (-k keeps on server) </WRAP> 
-<code> ffmpeg -i frame.%06d.ppm -b 3000 movie.mp4</code><WRAP indent> Convert a bunch of ppm files into a MP4 movie. </WRAP> 
-<code> find . | perl -pe "s/[^\/]*\//---|/g"</code><WRAP indent> Display directory tree. </WRAP> 
-<code> find . -print | cpio -pmd /path/to/dest</code><WRAP indent> Copy files with cpio (assumes you're in the directory you wish to copy from) </WRAP> 
-<code> find / -perm -4000 -o -perm -2000 -type f -ls </code><WRAP indent>  (finds SUID/GUID files) </WRAP> 
-<code> find / -type f -perm +111 -print | xargs file | grep '[QZ]MAGIC'</code><WRAP indent> Finds a.out executables </WRAP> 
-<code> find / -type f \( -name "bar*" -not -regex ".*snapshot/.*" \) -ls</code><WRAP indent> Search for all files which match "bar*" and the path doesn't contain ".snapshot" Very useful for finding stuff on NetworkAppliance volumes. </WRAP> 
-<code> find / -type f \( -name core -o -name dead.letter \) -atime +7 -mtime +7 -exec rm -f {} \;</code><WRAP indent> Search the entire drive for files called "core" or "dead.letter" which are older then 7 days and delete them. </WRAP> 
-<code> find /path/to/dir -inum 23455 -print</code><WRAP indent> Where 23455 is the inode you are looking for </WRAP> 
-<code> find /var/spool/mqueue -atime +8 -exec rm {} \;</code><WRAP indent> blah </WRAP> 
-<code> find `pwd` -maxdepth 1</code><WRAP indent> Prints out all the files in the current directory with their full path (this works too: ls -d1 `pwd`/*). </WRAP> 
-<code> find foo -maxdepth 3 -type f \( -name ".env*" -not -regex ".*snapshot/.*" \) -exec rm -fv {} \;</code><WRAP indent> Starting at the foo directory, recurse down three directory levels looking for any files whose name matches .env but which do not have .snapshot in their path (useful for netapps). </WRAP> 
-<code> for i in $(IFS=" "; grep -h '\[\[\!tag ' ~/svnroot/ikiwiki/*/*mdwn | sed -e 's/\[\[\!tag //' -e 's/]]//' ); do echo $i; done | sort -u</code><WRAP indent> Grep my IkiWiki blog for any line beginning with <code>[[!tag </code> strip off the formatting and print out one tag per line. </WRAP> 
-<code> for /f %i in ('net view /domain:TESTDOMAINNAME') do shutdown -m %i -r -t 10 -f -c "id10t system error" -d p:31:337</code><WRAP indent> [windows] The -t 10 is just in case a user is actually logged in to the test system, not that 10 seconds gives them much time to do anything but freak out :-).  The -c is just so they ask me what an "id10t system error" is. </WRAP> 
-<code> for i in *; do echo ${i}; chown -R ${i}@xyz.net:twntyblo ${i}; done</code><WRAP indent> Changes the ownership of everything in the current directory to user "<filename>@xyz.net" and group "twntyblo". </WRAP> 
-<code> for i in *jpg; do echo "$i ---- "; convert $i iptc:- | strings | head -1; done > .captions</code><WRAP indent> Use convert and a for loop to generate an ugly but easily cleaned .captions file for use by igal. </WRAP> 
-<code> fs_usage</code><WRAP indent> [mac] Shows file system usage. </WRAP> 
-<code> gawk 'BEGIN {x=0}{ while (x<2){ if (/EXAMPLE/) {x++;getline} else {print;getline}}}' /etc/raddb/users</code><WRAP indent> blah </WRAP> 
-<code> gawk '{if ($3!=$9) {print "rm /var/mail/"$9}}' varmail-ls.txt</code><WRAP indent> blah </WRAP> 
-<code> gawk -F, '{print "## "$3,$4; system("grep -i "$3" /etc/passwd | grep -i "$4" | cut -d: -f1")}' file.csv</code><WRAP indent> Use awk to generate a list of usernames from a CSV list of full names by grepping the passwd file. </WRAP> 
-<code> gawk -F: '{print $1}' /etc/passwd /etc/shadow | sort | uniq -c | egrep -v "^ *2"</code><WRAP indent> shows password file corruption </WRAP> 
-<code> gnome-font-install --afm-path=/usr/share/fonts/afms --pfb-assignment=ghostscript,/usr/lib/ghostscript/fonts</code><WRAP indent> blah </WRAP> 
-<code> grep 113 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Headers/MacErrors.h</code><WRAP indent> [osx] Search for the meaning of any OSX error code with 113 in it. </WRAP> 
-<code> LC_ALL=C grep --color '[^[:space:][:print:]]' surviving_the_nippy_bitch.mdwn</code><WRAP indent> Search and highlight any non-space or non-printable characters in the file surviving_the_nippy_bitch.mdwn.  Very useful for finding unicode characters which have snuck into a text file. </WRAP> 
-<code> gpg --verify linux-2.3.41.tar.bz2.sign linux-2.3.41.tar.bz2</code><WRAP indent> to verify a tar ball against a sig file </WRAP> 
-<code> gpg -u old-key-id --sign-key new-key-id</code><WRAP indent> sign a new key with your old key </WRAP> 
-<code> h2xs -AX -n IAI::Foo</code><WRAP indent> Creates a bare bones perl module template </WRAP> 
-<code> host -t txt -c chaos version.bind ns3 </code><WRAP indent> gives version number of bind </WRAP> 
-<code> http://lists.spack.org/mailman/options/lfjokes/load--at--spam.org</code><WRAP indent> personal page to modify individual sub's </WRAP> 
-<code> http://netapp.domain.com/na_admin/man/</code><WRAP indent> [netapp] Filer online manual pages. </WRAP> 
-<code> identify -verbose filename.jpg</code><WRAP indent> Print all information (including IPTC data) to standard out. </WRAP> 
-<code> ifconfig hme0:2 inet 0.0.0.0 down     </code><WRAP indent> removes interface completely under solaris </WRAP> 
-<code> ifconfig hme1 plumb -arp up</code><WRAP indent> Configures an interface without an ip but so you can still send packets out of it (cause it's plumb'd) </WRAP> 
-<code> igal -w 4 -n -bigy 640 -c</code><WRAP indent> Create thumbnail page with four images per column, omitting image count in caption, using captions and creating "web sized" images for display in slide page. </WRAP> 
-<code> imapsync --syncinternaldates --host1 localhost --user1 adam --password1 YourSpackPass --host2 imap.gmail.com --user2 adam@spack.org --password2 YourGmailPass --authmech2 plain --port2 993 --ssl2 --authmech1 PLAIN --authmech2 LOGIN --dry</code><WRAP indent> Migrate your email from an unencrypted IMAP service on localhost to Google Apps Gmail.  This requires that your Gmail account has IMAP enabled in the settings (new as of Oct 2007). </WRAP> 
-<code> inbox-path={pixmail.pixelworks.com/ssl/user=ashand}INBOX</code><WRAP indent> for ssl imap, apparently you need to set the user-domain as well(?). </WRAP> 
-<code> install-user /dev/ttyS0 "larry" 135235156</code><WRAP indent> where larry and 135235156 were taken from ~/.jpilot/jpilot.rc file using the value of user and user_id values. </WRAP> 
-<code> iosnoop -e -o</code><WRAP indent> [osx] shows you all the io activity for on the Mac (similar to par -k). </WRAP> 
-<code> ipchains -A input -s 209.112.156.66/255.255.255.255 -d 0.0.0.0/0.0.0.0 -j REJECT -l</code><WRAP indent> where the '-l' means log and IP.IP is the ip you want to block </WRAP> 
-<code> ipchains -D input 1</code><WRAP indent> where 1 is the rule number to delete </WRAP> 
-<code> ipchains -I input 1 -s 0/0 -d 0/0 22 -p tcp -y -j ACCEPT</code><WRAP indent>  IPChains allow </WRAP> 
-<code> ipconfig /flushdns</code><WRAP indent> [mac] Flushes the local DNS cache (useful if you've changed mail server IP addresses or something) (pre-Leopard only) </WRAP> 
-<code> ipconfig getoption en0 lease_time</code><WRAP indent> [mac] Prints DHCP lease time for interface en0. </WRAP> 
-<code> ipfwadm -I -f </code><WRAP indent> flush all incoming rules </WRAP> 
-<code> iptables -A INPUT -s 65.33.58.229 -j DROP</code><WRAP indent> IPTables deny </WRAP> 
-<code> jhead -nf%Y-%m-%d_%H-%M-%S file.jpg</code><WRAP indent> Renames all files listed to YYYY-MM-DD_HH-MM-SS (where date is when the picture was taken via EXIF data). </WRAP> 
-<code> jhead -nf%Y/%m/%Y-%m-%d_%H-%M-%S *.jpg</code><WRAP indent> Renames *.jpg listed to YYYY/MM/YYYY-MM-DD_HH-MM-SS. </WRAP> 
-<code> ldapsearch -v -h 192.168.4.201 -L -b "ou=people,dc=spack,dc=org" "cn=adam*" uid cn givenname</code><WRAP indent> Bind anonymously and search the LDAP tree, starting at ou=people for a cn which matches the expression "adam*" On a match print the uid, cn and given name. </WRAP> 
-<code> ldapsearch -v -h 192.168.4.201 -L -b "ou=people,dc=spack,dc=org" -D "uid=adam,ou=people,dc=spack,dc=org" -W "cn=adam*" uid cn givenname</code><WRAP indent> Same as above only bind as uid=adam and prompt for the password (-w <password> to specify on the command line) </WRAP> 
-<code> for i in 0 1 2; do ldapsearch -x -LLL -h ldap${i} -b "ou=Group,dc=spack,dc=org" "memberUid=adam" cn | sort | awk -F: '/^cn: /{printf $2}'; echo; done</code><WRAP indent> Print out a one line list of all the groups that the user adam belongs to via direct query to each of the servers ldap{0,1,2}. </WRAP> 
-<code> lfjokes-arc315: "| /usr/bin/hypermail -iu -c /var/web/earthlight/lists/jokes/hm.conf"</code><WRAP indent> aliases file for hypermail archiving </WRAP> 
-<code> lilo -r /mnt/pcmcia -C etc/lilo.conf  </code><WRAP indent> installs onto the /mnt mounted device using etc/lilo.conf as the source file. </WRAP> 
-<code> lookupd -d</code><WRAP indent> [mac] Debug name service switching and attribute mapping.  Try "?" for help, or tab for attribute completion (eg. "userWithName: adam" will show directory listings for adam) </WRAP> 
-<code> lookupd -flushcache</code><WRAP indent> Flushes the local DNS cache (useful if you've changed mail server IP addresses or something) </WRAP> 
-<code> lpadmin -p _default -s vger\!lp -I and -T unknown</code><WRAP indent> setup lp printing to a remote tcp host under solaris 2.6 </WRAP> 
-<code> ls -id *; find . -inum <inode number> -ok rm {} \;</code><WRAP indent> If you really can't delete a file any other way.  "ls -id" means don't go into directories and print out the inode of each file.  Then we take the inode of the weird file and tell find to delete that inode. </WRAP> 
-<code> ls | awk '{print "mv "$1, tolower($1)}'</code><WRAP indent> Uses awk to rename all files and get rid of any capital letters. </WRAP> 
-<code> ls -F | grep '/'</code><WRAP indent> List directories. </WRAP> 
-<code> lsbom /Library/Receipts/X11SDK.pkg/Contents/Archive.bom</code><WRAP indent> [mac] Lists all the files which were installed as part of the X11 package. </WRAP> 
-<code> lsof -R -p 2345</code><WRAP indent> Show all files attached to PID 2345 (-R means include ppid info). </WRAP> 
-<code> lsof -R -u larry,101</code><WRAP indent> Show all files attached to user larry and UID 101 (-R means include ppid info). </WRAP> 
-<code> lsof -i :80</code><WRAP indent> Show all traffic on port 80. </WRAP> 
-<code> lsof -i tcp</code><WRAP indent> Show all TCP traffic (can be udp as well). </WRAP> 
-<code> lsof -i tcp:80</code><WRAP indent> Show all TCP traffic on port 80. </WRAP> 
-<code> lsof -i udp@localhost</code><WRAP indent> Show all UDP traffic bound to localhost. </WRAP> 
-<code> lynx [-dump | -source] -nolist</code><WRAP indent> converts HTML <--> plain text </WRAP> 
-<code> makemap hash /etc/mailertable < /etc/mailertable</code><WRAP indent> blah </WRAP> 
-<code> man <command> | perl -pe "s/_\010(.)/\$1/g; s/(.)\010\1/\$1/g"</code><WRAP indent> remove control characters from man output </WRAP> 
-<code> man -M /share/man -s 8 cucipop</code><WRAP indent> finds non-indexed man pages </WRAP> 
-<code> mailx -a "Content-type: text/html;" -s "Daily Project Statistics" monkey@gmail.com < project_stats.html</code><WRAP indent> Send an email to monkey@gmail.com with the content of project_stats.html of being displayed inline in the mail message (and rendered as HTML). </WRAP> 
-<code> mii-diag -F 100baseTx-FD eth0</code><WRAP indent> force eth0 to mode (disable auto-negotiation) </WRAP> 
-<code> mkdir /ramdisk; mke2fs /dev/ram0; mount /dev/ram0 /ramdisk</code><WRAP indent> create and mount a ramdisk </WRAP> 
-<code> mke2fs /dev/hda1</code><WRAP indent> format a filesystem like newfs does in solaris </WRAP> 
-<code> mkfifo fifo; nc -k -l 6500 > fifo < fifo & while true; do nc destination-host 6500 < fifo > fifo; done</code><WRAP indent> FreeBSD/Bash while loop that will forward a local port (6500) to a remote host using netcat. Easy mod for other OS'es (mknod for Solaris etc). </WRAP> 
-<code> mkinitrd -o /boot/initrd.img-2.4.17 -r ext3 /lib/modules/2.4.17-686</code><WRAP indent> make an initrd filesystem with an alternate root filesystem </WRAP> 
-<code> mknod -m 640 /dev/tap0 c 36 16</code><WRAP indent> how to make a device </WRAP> 
-<code> mknod /dev/hdc b 22 0</code><WRAP indent> recreate device /dev/hdc (from cory) </WRAP> 
-<code> mogrify +profile iptc filename.jpg</code><WRAP indent> Strip IPTC data from filename.jpg. </WRAP> 
-<code> mogrify -format jpg *.bmp </code><WRAP indent> convert all bmp images to jpg images </WRAP> 
-<code> mogrify -geometry 640x640 -quality 80 image.jpg</code><WRAP indent> reduces image to max dimension of 640 (either x or y) and cranks up jpg compression. </WRAP> 
-<code> mogrify -verbose -resize x360 -resize '480x<' -resize 50% -gravity center -crop 240x180+0+0 +repage *jpg</code><WRAP indent> Resizes a directory full of images to thumbnail size suitable for incorporating into a "life poster" (see comment by [[http://diveintomark.org/archives/2007/08/12/cc-butterflies#comment-10057 |Mark Pilgrim]]). </WRAP> 
-<code> montage * -resize 120x90 -geometry 120x90x0x0 -tile 6x108 -quality 50 output-720x9720.jpg</code><WRAP indent> Take the thumbnails created above and composite them into a 6 image by 108 image "life poster" which is made up of images 120x90 pixels (see comment by [[http://diveintomark.org/archives/2007/08/12/cc-butterflies#comment-10057 |Mark Pilgrim]]). </WRAP> 
-<code> mount --bind /var/www /mnt</code><WRAP indent> Mount the directory /var/www on /mnt (tre cool!) </WRAP> 
-<code> mount -n -o rw,remount /</code><WRAP indent> Remounts root filesystem read/write </WRAP> 
-<code> mount -o loop rh7.2-i386-disc1.iso /mnt</code><WRAP indent> Mounts ISO image </WRAP> 
-<code> mount -t smbfs -o username=adam //home.spack.org/mp3 /mnt</code><WRAP indent> Mount the SMB/CIFS share called "mp3" from the server "home.spack.org" onto the local /mnt mount point.  It will prompt for a password. </WRAP> 
-<code> mount -t tmpfs -o size=50M,mode=700 tmpfs /mnt</code><WRAP indent> Create a RAM disk  (tmpfs) with a maximum size of 50MB and read/write only by root (default is mode 1777).  See /usr/src </WRAP> 
-<code> mount -t ufs -o ufstype=44bsd /dev/hda3 /mnt/bsd</code><WRAP indent> mounts a freebsd partition under linux </WRAP> 
-<code> mount /boot/initrd.img-2.4.17-686 /mnt -t auto -o loop=/dev/loop0</code><WRAP indent> mount your initrd file or loop filesystem </WRAP> 
-<code> mpage -4 -Pvger /var/web/ia/arch-meeting.txt</code><WRAP indent> 4 pg/pg to printer vger </WRAP> 
-<code> mplayer -dumpstream rtsp://foo.com/bar.rm -dumpfile baz.rm</code><WRAP indent> Uses mplayer to download the streaming media from foo.com to a local file called baz.rm.  Very useful for saving things to watch later (or dealing with high latency links).   Details on the [[http://www.mplayerhq.hu/DOCS/HTML-single/en/MPlayer.html#streaming-save |MPlayer homepage]]. </WRAP> 
-<code> mt -f /dev/rmt/0 [status|rewind]</code><WRAP indent> Query or rewind the tape drive. </WRAP> 
-<code> mv --update --backup=numbered bar.txt foo.txt :: Only replace foo.txt with bar.txt if it's newer, and backup foo.txt to foo.txt~#~ before overwriting (where</code><WRAP indent> is an ever incrementing number). </WRAP> 
-<code> mysql -u root -p -e "SELECT * FROM FooToBar WHERE Username=\"adam\"" -h mysql Baz</code><WRAP indent> Allows you to run a SQL query against a particular database from the command line.  Useful for "for i in ..." type situations. </WRAP> 
-<code> mysql -u root -p password drupal < /tmp/drupal.sql</code><WRAP indent> Import the contents of drupal.sql into the MySql database "drupal". </WRAP> 
-<code> mysqldump -Aa -u root -p password drupal > /tmp/mysql_all.sql</code><WRAP indent> Dumps the structure and the data of all databases to mysql_all.sql (including all the MySql specific create commands) </WRAP> 
-<code> mysqldump -d -u root -p password drupal > /tmp/drupal.sql</code><WRAP indent> Dumps the structure of the "drupal" database to drupal.sql. </WRAP> 
-<code> mysqldump -u root -p password drupal > /tmp/drupal.sql</code><WRAP indent> Dumps the structure and data of the "drupal" database to drupal.sql. </WRAP> 
-<code> mysql> SET PASSWORD FOR 'iaddressbook'@'localhost' = PASSWORD('secretpassword');</code><WRAP indent> Sets the password for the user "iaddressbook@localhost" to "secretpassword". </WRAP> 
-<code> mysql> show grants for iaddressbook@'localhost';</code><WRAP indent> Show all grants for the user "iaddressbook" on the host "localhost". </WRAP> 
-<code> ndd -get /dev/hme adv_100fdx_cap</code><WRAP indent> Queries ndd for status of that var. </WRAP> 
-<code> ngrep -qpi '(^user )|( login )' '(host 192.168.1.1 and ((port 143) or (port 110)))'</code><WRAP indent> Watch for traffic to 192.168.1.1 on ports 110 or 143 which start with "user" or contain "login". </WRAP> 
-<code> ngrep -t '^(GET|POST) ' 'src host 12.13.14.15 and tcp and dst port 80'</code><WRAP indent> For TCP traffic from 12.13.14.15 to port 80 print out any data payload lines which start with GET or POST.  Way handy for debugging CGI interaction. </WRAP> 
-<code> nidump group . > /tmp/group</code><WRAP indent> [mac] Dump the group data from Netinfo into a standard Unix groups file. </WRAP> 
-<code> niload -d group . < /tmp/group</code><WRAP indent> [mac] Deletes any existing Netinfo group data and then loads in the contents of a standard Unix group file. </WRAP> 
-<code> niload -v -m group . < /tmp/group</code><WRAP indent> [mac] Reads a standard Unix group file merges it into the Netinfo group database (so you end up with the union of the file and the Netinfo data). </WRAP> 
-<code> niutil -createprop / /users/username shell /bin/bash</code><WRAP indent> [mac] Changes users shell to /bin/bash (remember root) </WRAP> 
-<code> nmap -D 209.112.156.30 209.112.156.46 -sS -S10.0.0.5 -e eth0 -P0</code><WRAP indent> forges all headers </WRAP> 
-<code> nmap -sP -PT xxx.xxx.xxx.xxx/yy</code><WRAP indent> is a faster way to strobe </WRAP> 
-<code> nroff -man manpage.1 </code><WRAP indent> views a man page without man command </WRAP> 
-<code> nslookup -type=txt -class=chaos version.bind  ns3</code><WRAP indent> same as the host version </WRAP> 
-<code> ntpq -p</code><WRAP indent> shows which ntp servers you are connected to </WRAP> 
-<code> ntptrace</code><WRAP indent> useful for debugging ntp </WRAP> 
-<code> openssl s_client -connect hostname:465</code><WRAP indent>Test SSL connections to (probably SMTP) on port 465.</WRAP> 
-<code>openssl s_client -connect hostname:587 -starttls smtp</code><WRAP indent>Test SMTP STARTTLS connections on port 25 or 587.</WRAP> 
-<code> openssl pkcs12 -export -in <PEM format cert> -out <PKCS12 file></code><WRAP indent> Convert a PEM format certificate to a PKCS12 format certificate. </WRAP> 
-<code> openssl req -new -x509 -days 365 -nodes -out slapd.pem -keyout slapd.key</code><WRAP indent> use .pem for cert file, use .key file for cert and ca cert file. </WRAP> 
-<code> openssl req -new -x509 -days 365 -nodes -out stunnel.pem -keyout stunnel.pem</code><WRAP indent> generates a new key for stunnel called stunnel.pem </WRAP> 
-<code> openssl req -newkey rsa:1024 -keyout tempfile1 -nodes -x509 -days 365 -out tempfile2; cat tempfile1 > slapd.pem; echo "" >> slapd.pem; cat tempfile2 >> slapd.pem</code><WRAP indent> Generate a self-signed certificate. </WRAP> 
-<code> openssl s_client -connect localhost:993 -showcerts</code><WRAP indent> connects to a ssl'd port and shows certificate information </WRAP> 
-<code> openssl s_client -host www.spack.org -port 443</code><WRAP indent> similar to stunnel command, much more verbose </WRAP> 
-<code> openssl x509 -subject -dates -fingerprint -in stunnel.pem</code><WRAP indent> prints some info about the cert </WRAP> 
-<code> openssl s_client -starttls smtp -crlf -connect smtp.spack.org:587</code><WRAP indent> Connect to a mail server on port 587 (submission) which requires STARTTLS to issue any further commands. </WRAP> 
-<code> openssl s_client -crlf -connect smtp.spack.org:465</code><WRAP indent> Connect to a mail server on port 465 (SMTPS) which requires SSL before it will talk to you at all. </WRAP> 
-<code> par -SS -s -p <pid></code><WRAP indent> Irix equivelent of Linux "strace -p <pid>". </WRAP> 
-<code> par -SS -s /bin/ls</code><WRAP indent> Irix equivelent of Linux "strace /bin/ls". </WRAP> 
-<code> pbpaste | wc -c</code><WRAP indent> [mac] Take the contents of the clipboard (pasteboard) and pipe it to wc to count how many characters it has. </WRAP> 
-<code> pear config-set http_proxy http://adam:llama@proxy.spack.org:3128</code><WRAP indent> Configure PHP's pear program to use a password protected proxy to download updates. </WRAP> 
-<code> perl -MMIME::Base64 -e 'print encode_base64("\000adam\000password")'</code><WRAP indent> Generate the base64 encoded username:password pair which is used for smtp auth and (I think) HTTP basic auth (for smtp you'd use something like "AUTH PLAIN AKDJITGF3Btdd5ZnB0aGI="). </WRAP> 
-<code> perl -ne '/\000/ and print "$ARGV:$_";' foo.txt</code><WRAP indent> "Greps" the file foo.txt for any null characters and prints "<filename>:<matching line>". </WRAP> 
-<code> perl -i -pe  's/\000//g;' /var/spool/mqueue/df*</code><WRAP indent> Search all the data files in Sendmail's queue for null characters and remove them.  This very useful when spurious null characters crash your Cyrus LMTP process and cause your sendmail queue to backup forever. </WRAP> 
-<code> perl -MCPAN -e shell ; install Module::Name</code><WRAP indent> Install modules inside perl </WRAP> 
-<code> perl -MCPAN::Nox -e shell</code><WRAP indent> Tries to run things without the binary modules which will allow to to repair really broken stuff. </WRAP> 
-<code> perl -e 'print crypt( "blah", "AA" ) . "\n";'</code><WRAP indent> where AA is the salt </WRAP> 
-<code> perl -e 'print join "\n", @INC'</code><WRAP indent> pPints contects of @INC </WRAP> 
-<code> perl -e 'print scalar(localtime(1062518534)) . "\n";'</code><WRAP indent> . </WRAP> 
-<code> perl -e 'print scalar(localtime(@ARGV[0])) . "\n";' <unixtime></code><WRAP indent> Convert Unix time to normal time. </WRAP> 
-<code> perl -e 'printf "%02x"x4 ."\n",10,0,2,254;'</code><WRAP indent> Converts the IP 10.0.2.254 into hex. </WRAP> 
-<code> perl -e 'use Filter::decrypt'</code><WRAP indent> Tells you if you have a module installed </WRAP> 
-<code> perl -pi.bak -e 's/search for/replace with/' /tmp/filename</code><WRAP indent> Make a /tmp/filename for "search for" and replace it with "replace with" </WRAP> 
-<code> perl Makefile.PL PREFIX=/home/mydir/perl</code><WRAP indent> To install modules to home direcotry and then use "use lib '/home/mydir/perl';" inscript to have that dir included </WRAP> 
-<code> perl -nwe 'print if /[^[:ascii:]]/' surviving_the_nippy_bitch.mdwn</code><WRAP indent> Search for any non-space or non-printable characters in the file surviving_the_nippy_bitch.mdwn.  Very useful for finding unicode characters which have snuck into a text file. </WRAP> 
-<code> pgp4pine -e --debug -i /tmp/test.txt -o /tmp/test.pgp -r larry@spack.org</code><WRAP indent> blah </WRAP> 
-<code> pgpk -xa larry@alaska.net</code><WRAP indent> extracts public key to ascii file </WRAP> 
-<code> pgpv +OutputInformationFD=1 </code><WRAP indent> Pipe pgp message to this in pine </WRAP> 
-<code> photopc -s 115200 -f "%Y.%m.%d-%H.%M-%%1d.jpg" image 1-5 /home/larry/camera</code><WRAP indent> blah </WRAP> 
-<code> photopc image all /home/larry/camera</code><WRAP indent> blah </WRAP> 
-<code> pkgutil --expand /Volumes/AirPortUtility/AirPortUtility.pkg /tmp/airport </code><WRAP indent> Extracts conents from AirPortUtility.pkg into /tmp/airport </WRAP> 
-<code> pkgutil --pkgs</code><WRAP indent> Show all installed packages. </WRAP> 
-<code> pkgutil -v --file-info /usr/local/sbin/mtr</code><WRAP indent> Show what package /usr/local/sbin/mtr belongs to. </WRAP> 
-<code> pkgutil --unlink !de.novamedia.TechnologyBase</code><WRAP indent> Delete all of the files which belonged to de.novamedia.TechnologyBase. </WRAP> 
-<code> pkgutil --files org.rudix.pkg.mtr</code><WRAP indent> Show all files belonging to the package org.rudix.pkg.mtr. </WRAP> 
-<code> pkgutil --forget org.rudix.pkg.mtr</code><WRAP indent> Delete org.rudix.pkg.mtr from the package database. </WRAP> 
-<code> pod2man filename.pl | nroff -man </code><WRAP indent> turns perl pod docs into man page </WRAP> 
-<code> port deactivate subversion @1.4.4_0</code><WRAP indent> (MacPorts) Deselect a specific version of subversion (so you can activate a newer/older one) </WRAP> 
-<code> port activate subversion @1.4.5_0</code><WRAP indent> (MacPorts) Select a specific version of subversion to be the active one </WRAP> 
-<code> port uninstall subversion @1.4.4_0</code><WRAP indent> (MacPorts) Uninstall a specific version of subversion </WRAP> 
-<code> port -u upgrade subversion</code><WRAP indent> (MacPorts) Upgrade subversion to the latest version (without "-u" the old version won't be uninstalled automatically) </WRAP> 
-<code> pppd idle-disconnect <# of seconds></code><WRAP indent> Undocumented pppd feature </WRAP> 
-<code> priv set advanced</code><WRAP indent> [netapp] Put a filer into "secret ninja mode" where you get access to additional commands ("priv set admin" returns to normal mode). </WRAP> 
-<code> ps -Aw -o user,pid,ppid,pcpu,pmem,size,rss,priority,start_time,time,cmd</code><WRAP indent> blah </WRAP> 
-<code> ps -ef | awk '/[p]ico/ {system("kill -9 "$2)}'</code><WRAP indent> blah </WRAP> 
-<code> pwconf [fixes] and pwck [just checks]</code><WRAP indent> finds/fixes errors in /etc/passwd and shadow </WRAP> 
-<code> rcs -l /etc/dhcpd.conf; ci -u /etc/dhcpd.conf</code><WRAP indent> Resyncronize dhcpd.conf with the version in RCS and make it available for checking out. </WRAP> 
-<code> rcs -u blah blah</code><WRAP indent> break a lock as root </WRAP> 
-<code> rename "s/[!@#$%^&)|(-:;~><,{}'\`\?\*A]/_/g" *.mp3</code><WRAP indent> Rename all *.mp3 files in the current directory by replacing any "weird" characters with an underscore (rename is a great little utility that comes with many versions of Perl).  NOTE:  Make sure you use "-n" because I'm not positive that there aren't any interactions of all these special characters between the shell and Perl, it *seems* to work correctly but ... </WRAP> 
-<code> rm -- -weirdfile</code><WRAP indent> Deletes "-weirdfile", where "--' tells rm to not interpret any further leading -'s as arguments (only works with GNU rm though). </WRAP> 
-<code> rm -f /var/lib/dpkg/{lock,methlock}</code><WRAP indent> Stops locking problems with dpkg </WRAP> 
-<code> rm -i *</code><WRAP indent> Deletes everything in the current directory but asks you for confirmation (yes/no) before each file (allows the shell to do automatic escaping of odd characters). </WRAP> 
-<code> rm ./-weirdfile</code><WRAP indent> Deletes file called "-weirdfile" in current directory. </WRAP> 
-<code> rpm -Va  </code><WRAP indent> verifies all files on the system against known md5 checksums. </WRAP> 
-rpm -q -a      lists all redhat packages installed 
-<code> rpm -qpil <sompackage>.rpm    </code><WRAP indent> tells all about the package. </WRAP> 
-<code> rsync -av --partial --progress adam@spack.org:xcode_3.2.5_and_ios_sdk_4.2_final.dmg ~/Desktop/</code><WRAP indent> Download the file and keep the file if the transfer gets interrupted allowing it to be resumed where it left off. </WRAP> 
-<code> rsync -avHx --delete-excluded --progress --stats --exclude-from=/Users/adam/etc/tacsyncrc /Users/adam/ adam@roke.spack.org:/home/adam/</code><WRAP indent> How I backup my Mac laptop to my Linux file server (so their home directories are identical) </WRAP> 
-<code> runas /user:starshine\administrator cmd</code><WRAP indent> [windows] Opens a command window as the admin user on the machine starshine. </WRAP> 
-<code> runas /user:adam@spack.org "notepad my_file.txt"</code><WRAP indent> [windows] Runs "notepad my_file.txt" as the user adam on the domain spack.org. </WRAP> 
-<code> sc_usage 1234</code><WRAP indent> [mac] Sort of line Linux strace only in a top form and not really the same.  Shows information about PID 1234 </WRAP> 
-<code> scp ~/.ssh/identity.pub badger:.ssh/authorized_keys</code><WRAP indent> Installs SSH key for passwordless SSH. </WRAP> 
-<code> screen -D -r  </code><WRAP indent> detaches the *running* process and moves it to the current tty </WRAP> 
-<code> screen -r     </code><WRAP indent> reattaches an already detached screen session to the current tty </WRAP> 
-<code> screen <command>      </code><WRAP indent> runs a process normally </WRAP> 
-<code> security find-internet-password -gs posterous.com </code><WRAP indent> Search Mac's "Keychain Access" for all stored information (including password) associated with posterous.com. </WRAP> 
-<code> sed -i -e 131d ~/.ssh/known_hosts</code><WRAP indent> Delete line 131 from the known_hosts file (warning: -i is not fully portable). </WRAP> 
-<code> sed 's/<[^>]*>//g' foo.txt</code><WRAP indent> Removes anything contained in HTML brackets (eg. <>).  The trailing "g" means replace all instances not just the first on each line. </WRAP> 
-<code> sed 's/tty/ /' foo.txt</code><WRAP indent> Replaces first instance of tty on each line with a space where ever it finds it in foo.txt. </WRAP> 
-<code> sendmail -bd -d99.100 -d8.3</code><WRAP indent> 99.100 means don't fork and the second -d is the debug level you want </WRAP> 
-<code> sendmail -bi</code><WRAP indent>        The same as newaliases </WRAP> 
-<code> sendmail -bp -O QueueDirectory=/var/spool/mqueue2</code><WRAP indent> mailq from alt directory </WRAP> 
-<code> sendmail -bv lkadfj@edgarsports.co.nz</code><WRAP indent> shows a virtual addresses actual delivery point </WRAP> 
-<code> sendmail -q -v -O QueueDirectory=/var/spool/mqueue2</code><WRAP indent> run queue from alt. directory </WRAP> 
-<code> service ssh start</code><WRAP indent> [mac] Basically chkconfig for OSX, "--list" shows all available services. </WRAP> 
-<code> set dhcp server pool enabled <option> <value> (eg. "lease 86400")</code><WRAP indent> [cisco] sets dhcp values on the Cisco 675 </WRAP> 
-<code> setterm -blank 0</code><WRAP indent> disable's linux screen saver </WRAP> 
-<code> sh ip ro xxx.xxx.xxx.xxx</code><WRAP indent> [cisco] Will work with any ip not just networks </WRAP> 
-<code> show environment all</code><WRAP indent> [cisco] Shows temp and stuff </WRAP> 
-<code> show int | in Des</code><WRAP indent> [cisco] Basically "| grep Des" </WRAP> 
-<code> slapd -d 768 -f /etc/ldap/slapd.conf</code><WRAP indent> Start up OpenLDAP pointing explicitly to the config file and setting debugging to my preferred setting.  </WRAP> 
-<code> sleep `expr $RANDOM % 900`</code><WRAP indent> Sleep for a random amount of time between 0 and 900 seconds. </WRAP> 
-<code> smbclient //home.spack.org/mp3 -U ashand</code><WRAP indent> Login to the SMB/CIFS share called "mp3" on the server home.spack.org with the username "ashand" (it will prompt for a password). </WRAP> 
-<code> snmpwalk anc-naf1 passwd .1.3.6.1.4.1</code><WRAP indent> gets enterprise mibs </WRAP> 
-<code> snmpwalk anc-p50 passwd .1.3.6.1.4.1.307.3.2.1.1.1.14</code><WRAP indent> get ip addrs </WRAP> 
-<code> snmpwalk anc-p50 passwd .1.3.6.1.4.1.307.3.2.1.1.1.4</code><WRAP indent> get usernames </WRAP> 
-<code> softwareupdate</code><WRAP indent> [mac] Lists all required software updates from the AppleOsx site.  You can also use it to install the packages. </WRAP> 
-<code> sort -n -t. -k 1,1 -k 2,2 -k 3,3 -k 4,4 /etc/hosts</code><WRAP indent> sorts ip address nicely in order </WRAP> 
-<code> sort -n -t, -k 1.7 -k 1.4 -k 1 /tmp/test.csv</code><WRAP indent> Sorts a CSV into order by date (oldest to newest) assuming comma seperated fields and that the first field is in the format DD/MM/YYYY. </WRAP> 
-<code> speller=/usr/X11R6/bin/gaspell --dict-host www.dict.org</code><WRAP indent> using gui gaspell with dict service </WRAP> 
-<code> speller=/usr/bin/aspell check</code><WRAP indent> spell checking with aspell </WRAP> 
-<code> speller=/usr/bin/ispell</code><WRAP indent> spell checking with ispell </WRAP> 
-<code> ssh -t maxx.spack.org ssh evey.spack.org </code><WRAP indent> Transparently SSH to a second box via a first one.  Very useful for opening a shell on a host which isn't reachable from your current network. </WRAP> 
-<code> ssh -R 14343:imap.company.com:143 maus.spack.org</code><WRAP indent> If run from a box on "company.com's" private network (eg. behind their firewall), it creates a tunnel from maus.spack.org:14343 to imap.company.com:143 (which bypasses the firewall).  Because it's a remote (not a local) forwarded port "-g" doesn't work so it will only be available on from maus.spack.org via localhost. </WRAP> 
-<code>ssh maxx.shmoo.com cat .bash_profile | diff -u - .bash_profile </code><WRAP indent> Diff the remove .bash_profile with the local one. </WRAP> 
-<code> ssh -nNT -L 20000:localhost:20000 bob@jones</code><WRAP indent> Forwards port 20000 on jones to port 20000 on localhost while not creating a login session.  Good for writing tunnel init scripts around. </WRAP> 
-<code> ssh -g -L 9993:imap.spack.org:993 ashand@torkington.company.com</code><WRAP indent> Creates a tunnel from thain:9993 to imap.spack.org:993 via torkington.company.com.  This is especially useful if thain is behind a firewall and can't directly connect to imap.spack.org:993.  The "-g" means that any machine can connect to thain:9993 gets forwarded to imap.spack.org:993 (without "-g" it only works via localhost on thain). </WRAP> 
-<code> ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N ''</code><WRAP indent> Create passwordless 1024 bit SSH key (useful for "passwordless" SSH, see UsingSsh). </WRAP> 
-<code> statit -b; statit -e</code><WRAP indent> [netapp] Shows detailed snapshot of utilization between the time you ran the -b (begin) and -e (end) commands (only available in priv set advanced). </WRAP> 
-<code> strace -f -e open,read,write ls</code><WRAP indent> Uses strace to trace al open, read and write calls that a process and any forked children make. </WRAP> 
-<code> stunnel -c -d localhost:imap2 -r maus.spack.org:imaps</code><WRAP indent> create a daemon listening on the local imap port binding to the remove imaps port on maus </WRAP> 
-<code> stunnel -c -r localhost:pop3s</code><WRAP indent> as a client connect to localhost:pop3s (allows testing) </WRAP> 
-<code> stunnel -d imaps -r localhost:imap2</code><WRAP indent> Stuff </WRAP> 
-<code> stunnel -d pop3s -r localhost:pop3</code><WRAP indent> as a daemon offer and encrypted port pop3s which connects to an unencrypted port pop3 on localhost </WRAP> 
-<code> stunnel -d ssmtp -r localhost:smtp</code><WRAP indent> Stuff </WRAP> 
-<code> stunnel -f -D 7 -d pop3s -r localhost:pop3</code><WRAP indent> as above but don't fork into the background and put on highest debug level </WRAP> 
-<code> stunnel -p /etc/ssl/certs/stunnel.pem -d pop3s -r localhost:pop3</code><WRAP indent> sets up stunnel to map ssl traffic coming into 995 to the local pop port unencrypted. </WRAP> 
-<code> su - postgres; pg_dump -F p -d foo -t bar > /tmp/foo_bar.sql</code><WRAP indent> Dump the PostgreSql table "bar" of database "foo" to a file called foo_bal.sql (in ASCII format) </WRAP> 
-<code> svn switch --relocate svn+ssh://adam@wul.cc/projects/svnRepo svn+ssh://adam@wul.cc/projects/writing</code><WRAP indent> Change a working SVN directory to a new repository.  Really useful when things have to move and you don't want to check everything in first. </WRAP> 
-<code> sysconfig -r</code><WRAP indent> [netapp] Details of disks and volumes including failed disks, rebuiding disks and hot spares. </WRAP> 
-<code> sysconfig -v</code><WRAP indent> [netapp] Verbose output including disks, serial numbers, cpu's etc. </WRAP> 
-<code> sysctl -w net.inet.tcp.sendspace=65536</code><WRAP indent> [mac] Writes 65536 to the kernel parameter net.inet.tcp.sendspace.  It will persist after a reboot. </WRAP> 
-<code> sysctl net.inet.tcp.sendspace</code><WRAP indent> [mac] Prints the value of kernel parameter net.inet.tcp.sendspace. </WRAP> 
-<code> sysstat -u 10</code><WRAP indent> [netapp] Show system status with utilization percentages, updating every 10 seconds (10 seconds is optimal to sync with the Netapp internal timing mechanism). </WRAP> 
-<code> system_profiler</code><WRAP indent> [mac] Prints out a profile of all hardware and software installed. </WRAP> 
-<code> tar -svcf - . | ssh badger-spare 'cd /var/web/download && tar -xpf -'</code><WRAP indent> Moves data from localhost to badger-spare using tar through ssh. </WRAP> 
-<code> tar Sczvf /syjet/debmain.tgz / --exclude tmp --exclude proc</code><WRAP indent> backs up / excluding directories. </WRAP> 
-<code> tar cvf /dev/rmt/0c -M etc/ home/</code><WRAP indent> Tar to tape, spanning multiple tapes </WRAP> 
-<code> tar zvfx iai-cucipop.tar.gz cucipop-1.23b3/cucipop</code><WRAP indent> retrieves file cucipop from archive </WRAP> 
-<code> tcmcmd -G command -E soft anc-tc2-nmc:s1c1-2t1-24</code><WRAP indent> [Portmaster] Soft busies anc-tc2-nmc cards 1 & 2, time slices 1-24 </WRAP> 
-<code> tcpdump -i en1 tcp</code><WRAP indent> because I always forgot how to do this and want to put "proto" in front of it.  Can also use "ip" which is helpful. </WRAP> 
-<code> tcpdump -X -i eth0 'dst host 192.168.17.24 and (dst port 143 or dst port 110)'</code><WRAP indent> Example of a more complicated tcpdump filter. </WRAP> 
-<code> tcpdump -qp -i eth0 '(dst port 143 or dst port 110)'</code><WRAP indent> How to watch POP3 or IMAP4 traffic going to 192.168.1.1 </WRAP> 
-<code> tcpdump -r <infile> -C 100 -s 0 -w <outfile></code><WRAP indent> Reads in saved pcap file <infile> and writes out files no larger then 100MB, "-s 0" means preserver the full data stream. </WRAP> 
-<code> telnet root0.rwhois.net 4321</code><WRAP indent> Admin-Contact=as8324.net </WRAP> 
-<code> tethereal -V dst port 143 | egrep -i login</code><WRAP indent> Snag IMAP usernames and passwords. </WRAP> 
-<code> tip -v 9600 /dev/ttya</code><WRAP indent> Connect to the console port on a sun </WRAP> 
-<code> tr '[A-Za-z]' '[N-ZA-Mn-za-m]'</code><WRAP indent> un-rot13 a message, and it works in pine if you enable the "|" command </WRAP> 
-<code> tr '\015' '\012' < macfile > unixfile</code><WRAP indent> Converts carriage to linefeed </WRAP> 
-<code> tr -d '\r' < dosfile > unixfile</code><WRAP indent> removes all ^M's from dos file) </WRAP> 
-<code> trap '' 1 2 15</code><WRAP indent> ignore signals 1,2 and 15 </WRAP> 
-<code> trap 'rm -f $TMP; exit 1' 1 2 15</code><WRAP indent> trap for signals 1,2,15 and rm file if found </WRAP> 
-<code> truss -f -p PID</code><WRAP indent> [solaris] truss pid PID and follows forks (good for daemons) </WRAP> 
-<code> Turns on bold: \[\033[1m\] Turns off bold: \[\033[0m\]</code><WRAP indent> Allows bold characters in Bash prompts. </WRAP> 
-<code> user_pref("mail.allow_at_sign_in_user_name", true);</code><WRAP indent> [netscape/mozilla/thunderbird] http://help.netscape.com/kb/consumer/19981212-1.html </WRAP> 
-<code> valkyrie:/usr/private/etc/radpwtst -p 1645 -s kira.alaska.net larry </code><WRAP indent> make sure they are in the /usr/private/etc/raddb/clients file so that it can find the radius secret </WRAP> 
-<code> vm_stat 5</code><WRAP indent> [mac] Similar to the Unix utility.  Prints out every 5 seconds. </WRAP> 
-<code> vol scrub status</code><WRAP indent> [netapp] Shows the status of currently running disk scrubs. </WRAP> 
-<code> vol status</code><WRAP indent> [netapp] Shows the status of all volumes, including if any are in the process of rebuilding a disk. </WRAP> 
-<code> wcc -s ashand</code><WRAP indent> [netapp] Shows the Unix name that the NT name "ashand" maps to. </WRAP> 
-<code> wcc -u ashand</code><WRAP indent> [netapp] Shows the NT name that the Unix name "ashand" maps to. </WRAP> 
-<code> withlist -l -r fix_url wordup -u lists.spack.org</code><WRAP indent> Mailman command for updating a mail list to have the correct URL (see /usr/lib/mailman/Mailman/Defaults.py for more info).  Very useful when migrating lists to a new domain and none of the web forms will work because the submit buttons still point to the old location. </WRAP> 
-<code> wget -q --mirror -p --html-extension --base=./ -k -P ./ http://adam.shand.net/blog/</code><WRAP indent> How to make a static copy of a Drupal (or any other dynamic) site. </WRAP> 
-<code> wget -q --proxy=off --html-extension -r -l 2 -nH --cut-dirs=4 -np -k -P foobar -p http://user:pass@www.spack.or/one/two/Statistics/GoStats/Index.html</code><WRAP indent> Okay this is complicated.  (-r) Recursively download for (-l 2) two levels, (-np) but don't go up any directory levels, (-p) everything required (css, images etc) for the URL, (--html-extension) make sure all html pages get saved to files ending in .html and (-k) rewrite the downloaded pages to link to the right page names.  (-P) Save all files to a folder called foobar, (-nH) don't create a directory for the host name and (--cut-dirs) cut four levels from the directories (so everything goes directly into foobar).  Wheew ... </WRAP> 
-<code> wget --proxy=off http://USER:PASS@www.spack.org/</code><WRAP indent> Embed HTTP username and password in the URL and ignore any *_proxy environment variables which are set. </WRAP> 
-<code> wget -m ftp://user:password@ftp.domain.com/path/to</code><WRAP indent> mirror ftp heirarchy </WRAP> 
-<code> wget -r -l2 http://www.blah.com/path/to/file/</code><WRAP indent> recursively grab just that directory </WRAP> 
-<code> while /bin/true; do gawk '/eth0:/ {print  $14}' /proc/net/dev; sleep 1; done</code><WRAP indent> While loop to watch collision stats under </WRAP> 
-<code> whois "name pixelworks"</code><WRAP indent> lists first 50 domains which contain pixelworks in the name </WRAP> 
-<code> whois "server NSblahblah-HST"</code><WRAP indent> lists the first 50 domains hosted. </WRAP> 
-<code> whois -h whois.geektools.com ""</code><WRAP indent> help file </WRAP> 
-<code> whois -h whois.geektools.com iprolink.co.nz</code><WRAP indent> any fld will work </WRAP> 
-<code> whois -h whois.networksolutions.com 'dump dom logic.net'</code><WRAP indent> raw dump, good for scripts </WRAP> 
-<code> whois -h whois.networksolutions.com 'dump han em69'</code><WRAP indent> raw dump, good for scripts </WRAP> 
-<code> whois ns4.alaska.net</code><WRAP indent> gives you NSblahblah-HST (can use IP# too) </WRAP> 
-<code> wine -dll commctrl,comctl,commdlg,comdlg32=n napster.exe</code><WRAP indent> to run windows napster </WRAP> 
-<code> wterm -geometry 192x8+0+0 -name console -C</code><WRAP indent> my exconsole </WRAP> 
-<code> wterm -tr -sh -bg <tint color> -fg <text color> -st -sb</code><WRAP indent> blah </WRAP> 
-<code> xv -root -quit -rmode 5 image_name</code><WRAP indent> equiv: Root: <something>" where 5=center </WRAP> 
-<code> xwrits breaktime=1 typetime=15 +finger=american +top +noiconify +mouse +lock</code><WRAP indent> Sensible defaults for Xwrits (see MicroPauseSoftware) </WRAP> 
-  

2014 by adam shand. sharing is an act of love, please share.