Desktop OCD (Why I switched from a 17″ Macbook Pro, to an 11″ Macbook Air)

IMG_1527Recently my employer was extremely kind enough to spoil me yet again and replace a late 2010 17″ Macbook Pro I was using with an 11″ 2013 Haswell Macbook Air.  It’s taken some time for me to define what a laptop should be, and have recently come to the conclusion that a laptop should be light, with form factor conventions that make it wieldy, convenient to take from one location to the next, and facilitate your work and entertainment on the go.

Over the years it’s taken me some time to realize what I need out a workstation, and laptop.  My original school of thought for the past 12 years was that I needed an extremely high resolution for desktop real estate whether it be a workstation or laptop. This was partly because I was battling with what some may consider mild OCD with my workspace and workflow in relation to my desktop scheme, and because I still wanted to play Blizzard and Steam games.  I believed that my desktop application placement had to be perfect, ranging from e-mail client, to terminal, and various other applications.  I was also determined to cram every regularly used application in tight order onto one screen, which is why I originally thought that a 17″ Macbook Pro for my work on the go was a good idea.

By now it should be pretty apparent that I was very slow to adopt multiple virtual desktops with what OSX implemented in Spaces (something that I was already aware of for years with Linux GUI desktop managers) some revisions of Macintosh exotic cat named operating systems ago.  When I started dealing with more Windows administration and VMWare for my job, I found that using multiple virtual desktops was a far more efficient way to work.  Finally, realization set in that it’s okay to have a “messy” desktop and in a sense was relieved by this.  After this minor technical enlightenment, I became increasingly more frustrated lugging around a 17″ Macbook Pro (#firstworldproblems).  It got to the point where I didn’t want to use it in any situation other than sitting at a desk.  Enter the Macbook Air.

Since I’ve been using the Macbook Air for the past 2 weeks, I have realized how well this ultrabook works for me and how impractical the 17″ Macbook Pro was.  I actually enjoy taking the Air to work, and meetings now, where as before I preferred to keep the 17″ Macbook Pro on my dining table, or desk and rarely traveled with it.  As for games, I found that I was hardly gaming after a while.  The other thing that I’m really impressed with is battery life.  9 hours of usage is very impressive compared to what I was seeing before with the Pro.

I guess the lesson learned here on a somewhat deeper level is to practice sensibility more often.  This is something I think I’m still struggling with and striving to be better at in my mid-30’s.


OSX & Linux Disk Benchmarking

As a SysAdmin, you’ll need to benchmark disk performance from time to time, or rather just gloat that your system’s drive is better than your buddy’s. In my particular case, I have an existing need to quantify performance metrics on my work macbook pro’s disk speed with Symantec PGP (don’t get me started on this product), without it, and with Apple FileVault in place of it.

Perusing the web I came across a good article from that assisted me with my disk benchmark testing.  This can apply to OSX and most Linux systems as well.

To test a system’s write speed, I used the following command from a terminal window:

time dd if=/dev/zero bs=1024k of=speedtest count=1024

Output from my work iMac w/SSD:

1024+0 records in
1024+0 records out
1073741824 bytes transferred in 8.948791 secs (119987362 bytes/sec)

real 0m8.954s
user 0m0.001s
sys 0m0.413s

The bytes per seconds number when converted to Megabytes equates to 114.42887 Mb per second.

To test the read speed of my disk, I ran the following from

dd if=speedtest bs=1024k of=/dev/null count=1024


1024+0 records in
1024+0 records out
1073741824 bytes transferred in 0.145955 secs (7356659197 bytes/sec)

So this is around 7016 Mb (6.8 Gb) per second with some rounding.  Based on the above output results, my work iMac w/ SSD can write at 114 Mb/s, and read at 6.8Gb/s.

When I get around to testing on my work laptop, these commands should give me good data metrics.

As far as bytes to Mb/Gb/etc conversioning goes, you can use google conversion web tools, or the “units” command on a Linux host if available.  There are several alternatives you can use as well.

Units Linux command sample for reference:

units –terse “119987362 bytes” “MiB”



Clearing Memory Cache with Linux

Linux is usually pretty good at efficient memory management notably with freeing up cached memory.  At times when an application(s) is abusing your system, Linux may decide that cached memory is needed when in fact it’s not.  This in turn can and will eventually rob your server of free memory.  A way to combat this is to run this simple command:

sync; echo 3 > /proc/sys/vm/drop_caches

If you need to do this on a scheduled basis, you can turn the above line into a script, and create a cron job for it.  It’s a bad sign if  apps or system functions are hogging up free memory when it doesn’t need it, so it’d be better to investigate and troubleshoot that aspect of your system, rather than blindly clearing the memory cache of a system.

Parallel remote "shelling" via pdsh

Ever have a multitude of hosts you need to run a command (or series of commands) on?  We all know that forloop outputs are super fun to parse through when you need to do this, but why not do it better with a tool like pdsh.
A respected ex-colleague of mine made a great suggestion to start using pdsh instead of forloops and other creative make shift parallel shell processing.  The majority of my notes in this blog post are from him.  If he’ll allow me too, I’ll give him a shout out and cite his Google+ profile for anyone interested.
Pdsh is a parallel remote shell client available from sourceforge.  If you are using rpmforge CentOS repos you can pick it up there as well, but it may not be the most bleeding edge package available.
Pdsh lives on sourceforge, but the code is on google:
Usage docs:
Some quick tips on how to get started using pdsh:
  1. Set up your environment:
  2. export PDSH_SSH_ARGS_APPEND=”-o ConnectTimeout=5 -o CheckHostIP=no -o StrictHostKeyChecking=no” (Add this to your .bashrc to save time.)
  1. Create your target list in a text file, one hostname per line (in the examples below, this file is called “host-list”
  2. It would probably be a good idea to use “tee” to capture output.
    • man tee” if you need more information on tee.
  3. Run a test first to make sure your pdsh command works the way you think it will before potentially doing anything destructive:
    • sudo pdsh -R ssh -w ^host-list “hostname” | tee output-test-1
  4. Change your test run to do what you really want it to after a successful test.  e.g.:
    • sudo pdsh -R ssh -w ^host-list “/usr/bin/mycmd args” | tee output-mycmd-run-1
Obviously if you have Puppet Enterprise fully integrated within your environment, you can take advantage of powerful tools such as mcollective.  If you do not, pdsh is a great alternative.

Get Your grep-fu On

More sysadmin goodness from

Search for red OR green:

grep ‘red|green’ files

Search for searchtext at the beginning of a line in files:

grep ‘^searchtext’ files

Search for searchtext at the end of a line in files:

grep ‘searchtext$’ files

Search files for blank lines:

grep ‘^$’ files

Search files for US formatted phone numbers (###-###-####):

grep ‘[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]’ files


grep ‘[0-9]{3}-[0-9]{3}-[0-9]{4}’ files

Search for e-commerce or ecommerce in files:

grep e-*commerce files

Search for searchtext case-insenstively in files:

grep -i searchtext files

Chain two grep commands together for more advanced searches. Search for lines in files that contain both partial_name and function:

grep partial_name files | grep function

That one is great for searching source directories for a function definition when you can’t remember the completely function name.

Linux-Fu Part 2

Figured it’s high time for a nerd SysAdmin blog post.  This one will be particularly bland with some commands and tools I use to administer Linux systems.

Ever wanted to get a quick and dirty count of open files by process?

lsof | awk '{ print $1" "$2; }' | sort | uniq -c | sort -n

This is pretty useful when you’re starting to deep dive a system.

Take netstat to the next level and  look for active server network ports so you can tell users you support that their app is running

[root@deadbeef ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0    *                   LISTEN      4083/spread
tcp        0      0*                   LISTEN      4083/spread
tcp        0      0      *                   LISTEN      5138/python   
tcp        0      0       *                   LISTEN      3673/snmpd 
tcp        0      0       *                   LISTEN      4019/sendmail
tcp        0      0        *                   LISTEN      8942/sshd 
tcp        0      0      *                   LISTEN      4019/sendmail

Ever wanted to get dmidecode in a somewhat useful format?

[root@deadbeef ~]# for kw in $(dmidecode -s 2>&1 | sed -n '3,$p'); do echo -en "e[1m${kw}:e[0m "; echo $(dmidecode -s ${kw}); done
bios-vendor: Dell Inc.
bios-version: 2.3.1
bios-release-date: 04/29/2008
system-manufacturer: Dell Inc.
system-product-name: PowerEdge 1950
system-version: Not Specified
baseboard-manufacturer: Dell Inc.
baseboard-product-name: 0H878G
baseboard-version: A01
baseboard-serial-number: ..CN6970284D1596.
baseboard-asset-tag: Not Specified
chassis-manufacturer: Dell Inc.
chassis-version: Not Specified
chassis-asset-tag: Not Specified
processor-manufacturer: Intel Intel
processor-version: Intel(R) Xeon(R) CPU X5460 @ 3.16GHz Not Specified

Adding color to your bash prompt

As a big mac user, one of my long time complaints have always been about color in my bash shell not translating over to a Linux host I’m ssh’ing into (predominantly CentOS/RHEL hosts).  A work around I’ve found to address this was to edit my .bashrc on linux systems I use as follows:

export LS_OPTIONS=’–color=auto’
eval `dircolors`
alias ls=’ls $LS_OPTIONS’

If you want color in your mac terminal you can add the following lines to your .bash_profile under your home directory in /Users (e.g. /Users/jdoe).

For dark terminal theme users:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

For light terminal theme users:

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

Special thanks and credit to OSX Daily for the color OSX Terminal tips.


So this above is all fine and dandy, but I’ve found that declaring terminal type as ‘terminal-color’ a better option for me.