MondayManPage

Latest

  • Monday man page: curl

    by 
    Michael Rose
    Michael Rose
    03.05.2007

    Today's man page covers one of my favorite utilities: curl. No, it's not a haircare product -- it's one of the most flexible download tools in the kit bag, with the ability to handle almost any protocol that can be addressed via a URL (hence the name, short for "client for URLs"). If there's a server out there that's reachable via HTTP, HTTPS, FTP, SFTP, SCP, and lots of other alphabet soup, curl can talk to it. curl http://www.tuaw.com/2007/03/05/monday-man-page-curl/ -- display the source of this very article in Terminal curl ftp://ftp.panic.com -- list the contents of a remote FTP site, in this case one with a pretty good FTP client curl -o ~/Desktop/curl-man.html http://curl.haxx.se/docs/manpage.html -- copy the curl manpage to your desktop; if you use capital -O, the local file mirrors the remote filename curl has an excellent usage manual at its site, detailing examples of use and advanced techniques. While there are zillions of ways to use curl in site testing, analysis and uploading, my favorite way of using it is as a quick file downloader. Read on for the details.

  • Monday man page: open

    by 
    Michael Rose
    Michael Rose
    02.12.2007

    Just a quick hint for today's man page: the open command does just what you might think. It opens files, directories, applications or URLs; no muss, no fuss. For files, you can specify an application to open them with the -a flag (or just trust LaunchServices to pick the right app). If you want to, the -e flag will force them to open in TextEdit. open ~/Desktop/MyWordDoc.doc [will open in MS Word] open -e ~/Desktop/MyWordDoc.doc [will open in TextEdit] open ~/Desktop/*.doc [opens every Word document on the desktop, in Word] open http://tuaw.com [well, give it a go!] I use open in installation scripts or other situations where I want a GUI application to come up at the end of a process. For example, open /System/Library/CoreServices/Software\ Update.app/ launches Software Update and begins checking for available patches. Sure, you can force an update with 'softwareupdate -i -a' anytime, but maybe I want to give the person sitting at the console an opportunity to select the updates needed, or cancel out of the possibly-lengthy update cycle until it's more convenient. You could also use the URL functionality to take people to a 'readme' website... the possibilities are manifold.

  • Monday man page: lsof

    by 
    Michael Rose
    Michael Rose
    02.05.2007

    Happy hangover Monday everyone! To soothe those post-big-game blues, here's this week's man page -- lsof, the LiSt Open Files tool. If you're trying to figure out why a removable drive won't unmount or track down a stray outbound network connection, this is the tool for you. Note: If you want to stay out of the command line but still accomplish some of the same tasks, a reader suggests you check out Sloth. Written by Vic Abell of Purdue University (now retired), the power and flexibility of lsof has given it the distinction of reputedly having more command-line flags than any other tool: lsof [ -?abChlnNOPRstUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ +|-L [l] ] [ +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -- ] [names] Yee-ikes. Let's get two quick tips taken care of before we move on to the details. First, you probably don't ever want to run lsof with no options specified, as that will generate a list of every open file on your machine (likely thousands of lines). Second, for a quick review of all those options, try lsof -h. More after the break...

  • Monday man page: dig, host & nslookup

    by 
    Michael Rose
    Michael Rose
    01.29.2007

    For this week's Monday man page, it's a triple threat: dig, host, and nslookup. All three utilities are included with the BIND (Berkeley Internet Name Domain) version 9 package, part of every Mac OS X 10.4 installation, and all three do pretty much the same task: translate hostnames to IP addresses and vice versa. In 10.3.9 and earlier, the Network Utility 'lookup' tab was a front-end for nslookup, with an option via checkbox to use dig instead; starting in 10.4 the checkbox is gone and the utility is dig-only. If you want a good introduction to how DNS works, the MacDevCenter has an excellent primer, and I can also heartily recommend DNS and BIND, possibly the most comprehensible book about a complicated subject that I've ever read. After the jump, we'll talk a bit more about how DNS lookup tools are useful, and why you might prefer one of this troika to the others.