Category: CLI

  • Mac OSX DHCP debuging

    Once in a while you might want to dig deep into OSX’s dhcp client and find out what dhcp packet the server sent it. A quick command to spit out this info:# ipconfig getpacket en0This produces the following output: op = BOOTREPLY htype = 1 dp_flags = 0 hlen = 6 hops = 0 xid…

  • USB-to-Serial console for Mac (OSX)

    Here are some notes for those of us working with Macs, who also have to deal with networking gear that usually have a serial console for local control. I recently purchased a IOGEAR USB 1.1 to Serial Converter Cable that uses the PL2303 chipset (pretty much any brand of these usb to serial converters use this…

  • OSX Webmaster special: Shared webserver, bad umask settings, group permissions and filenames with spaces…

    Okay so this all started with our users not being able to share files on our webserver. We use SSH only for upload/download and interactive access (ie: no ftp). Through trial and error we found out that the default umask (under OSX Server) for sftp uploaded files are 0033 (ie: rwxr–r–) and directories are 0022…

  • screen…it’s not just for nerds anymore.

    So after hearing from people at work how great the “screen” command was (yeah welcome to gnuland boys and girls), I decided to do a short tutorial on screen. This way I can stop telling them to RTFM and instead tell them to RTFB (Blog). Anyways, What is “screen” first of all….From the pages of…

  • Couple of cool remote ssh commands for your UNIX arsenal

    Here is a easy way to copy an entire directory tree from one Unix machine to another, while retaining the permisssions and ownership, using ssh as the middle man. Assuming that you want to copy everything under source_directory to destination_directory on another machine here is the command you would issue on the source machine (first…

  • Immediate delete for USB drives under OSX

    Okay so how many times have you “deleted” a file on a USB drive under OSX only to find out later that the storage is still tied up in .Trashes directory. Well there is a easy way to fix this. Open terminal, cd to your USB drives root directory (mounted under /Volumes) and issue the…

  • Find your Mac’s Serial number from CLI

    Okay couple of quick ways to find the serial number of your mac.ioreg -l|grep IOPlatformSerialNumber|awk ‘{print $4}’|cut -d \” -f 2orioreg -l | awk ‘/IOPlatformSerialNumber/ {print $4}’ | sed ‘s/\”//g’Very useful when you’re logged into your Mac remotely and call apple helpdesk with a issue.

  • Couple of quick shell tips

    Okay these are bash goodies, so they’ll work in any environment. If you’re in a situation where you’re switching between two different directory paths over and over again, here is a quick tipcd – Another little annoyance that I’ve gotten around is when you want to edit a system file and you type in the…

  • Quickway to check your DNS settings under OSX

    This is another CLI command, so get your terminal ready. This gives you a quickway to check the DNS settings on OSX. Now one way is to just cat /etc/resolv.conf , but what if you wanted to see what the system is actually using (not just what it was configured for). Well scutil comes to…

  • OSX Directory Services from Command-line

    New day, new command. dscl is the command in question. It gives you access to Mac OSX’s Directory Services Command Line interface. Very powerful stuff for those of us who like the command line and hate to do the same task a million times. A useful example is the ability to grant Administrator privileges to…