Seldom used Commands

Published by theRod on Sunday, September 14, 2008

Here is the list of all those commands I used one in a while and regularly forget:

  • Update MacOS X from the shell:
    sudo softwareupdate -i -a
  • Set ARM cross compiler (for linux kernel)
    alias smake='make ARCH=arm CROSS_COMPILE=arm-linux-gnu-'
  • Mount root via nfs
    root=/dev/nfs nfsroot=IP:/path/to ip=dhcp etc etc...
  • Crop images
    for a in DS*.JPG; do convert -verbose -crop 1250x1470+300+50 $a "Z$a"; done
  • Invert & Normalize
    for a in ZDS*.JPG; do convert -verbose -negate -normalize $a "NZ$a"; done
  • Set volume in MacOS X via command line:
    osascript -e "set Volume 0"
  • Deboostrab a debian tree…
    debootstrap --foreign --arch arm lenny chroottarget "http://ftp.de.debian.org/debian"
  • If the arch is foreign needs a second stage:
    chroot $TARGET /debootstrap/debootstrap --second-stage
  • Concatenate PDFs
    gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf *.pdf
  • Split PDFs into JPGs (wants ImageMagick). It automagically appends image numbers to the outfile.
    convert -density 300x300 infile.pdf outfiles.jpg
  • Split PDFs using GhostScript (convert tends to eay up all ram and swap) using a FOR loop:
    for i in {$begin..$start}; do gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=$i -dLastPage=$i -sOutputFile=out$i.pdf in.pdf; done
  • Disable spindump for crash reports on OSX
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist