Alan Hargreaves' Weblog
The ramblings of an Australian SaND TSC* Principal Field Technologist
* Solaris and Network Domain Technology Support Centre - The group I work forTags
(update 1) acoustic bind birthday blues bugs cec cec2007 cec2008 china cmt contention cringley debugging dogs dtrace earthquake encumbered-binaries extra flash funny google guitar halloween huron install kids linux liveupgrade locking mdb music mysql newyear niagra openjava opensolaris oracle patches patents percussion performance redhat secondlife security solaris sru sun support sxcr t2 t2000 timeslider ufs upgrade virtualbox windows youtube zfs
Wednesday Aug 08, 2007
Finding undocumented command options
I had a colleague this morning asking about undocumented (ie not listed in usage or man pages) options in a command. The actual command doesn't really matter, but I was feeling a little lazy and couldn't bothered looking up the source code to the command (which actually wasn't in ON). Almost immediately I thought of DTrace.
Let's have a look at ls as an example. I'll give it a dummy directory as I really don't care about the output.
$ dtrace -q -n 'pid$target::getopt:entry {trace(copyinstr(arg2));}' -c 'ls /nosuchfile'
/nosuchfile: No such file or directory
aAbcCdeEfFghHilLmnopqrRsStux1@vV
As you can see, the second line of output is printing out the third argument (arg2) to getopt(3c), which will list every option that getopt(3c) will recognise for the command.
Of course I could have prettied it up, but it's a one liner, I know what the output means.
The point being, that DTrace is just another sysadmin tool to be used in day to day operations.
Technorati Tags: Solaris, OpenSolaris, DTrace
Yes I know I have been lax in my blogging, I'm going to start doing something about that, starting with this one :-)
Posted at 11:47AM Aug 08, 2007 by Alan Hargreaves in OpenSolaris |

