Tom + Strata @ LISA '06 in Wash D.C., Dec 3-8, 2006

Tom and Strata be teaching and speaking at LISA 2006 in Washington D.C., Dec 3-9, 2006. This is one of our favorite conferences of the year because it is so dam useful. Get your boss to send ya. This year it is in Washington D.C., which makes it easy to get to for all the east-coasters that usually don't get around.

Tom will be speaking/teaching:

Mon9am-5pmWorkshopManaging Sysadmins (co-facilitator)
Wed2pm-3:30Invited TalkSite Reliability at Google/My First Year at Google
ThuAMTutorialTime Management: Getting It All Done and Not Going (More) Crazy!
Thu12:30pm-1:30pmExhibition"Meet the Authors" at Reiter's Conference Bookstore
Thu2pm-3:30Guru TalkHow to Get Your Paper Accepted at LISA
Thu4pm-5:40Guru TalkTime Management for System Administrators
Fri11am-12:30Hit The
Ground
Running
Mac OS X

Strata Rose Chalup will be speaking/teaching:

MonPMTutorialProject Troubleshooting
WedPMTutorialProblem-Solving for IT Professionals
ThuAMTutorialPractical Project Management for Sysadmins and IT Professionals
Wed9pm-10pmBOFSysadmin Education

In addition, we will be hanging out in what is known as "the hallway track". In fact, if you haven't attended LISA before, you should know that a lot of the educational value is the people you meet. Tom says, "Early in my career a lot of what I learned was from the conversations in the hallway."

Macintosh invents the TAB key!

Mac OS X 10.4.3 fixes about a zillion different bugs. None of them interest me except the fact that in Mail.app...

THE TAB KEY NOW INSERTS A TAB INSTEAD OF 4 SPACES

...which was my #1 annoyance about the entire Mac OS X system. Thank you, Apple!

Run "sed" on your cut&paste buffer

Two little known Mac OS X commands available from the Unix shell ("Terminal") are pbpaste and pbcopy. They are used for retrieving and sending text to the paste buffer. pbpaste outputs the cut&paste buffer to stdout. phbcopy reads stdin and puts it into the cut&paste buffer.

The more I use these commands the more new ways I find to use them. Read on.

Basic cutting and pasting:

Let's start with the basics.

Reading and writing the cut&paste buffer:

To store something, just send it to pbcopy's stdin.
pbcopy <file.txt

Easy. Right? Now go into TextEdit or MS-Word and paste (CMD-V). The file gets pasted. It's much more accurate than selecting the file from the screen. No worries about missing the first or last line, etc.

Now do the opposite. Select a bunch of text in your favorite application and copy it into your cut&paste buffer. (CMD-C) Want to save it to a file?

pbpaste >newfile.txt
The entire buffer is there. Check it and see.

Paste pipeline into buffer:

Ever been working in the Unix shell and wanted to take the output of one command and paste it into an application? (For example, paste into MS-Word for a book you are writing). That becomes a lot easier:

ls ????-*-IRR.txt | pbcopy
Now the output goes into the paste buffer.

If we want to see the output too, we can either run the command twice (once with the "|pbcopy" and once without) or we can simply add a "tee" command:

ls ????-*-IRR.txt | tee /dev/tty | pbcopy

Here's a longer command line:

ls | tr '[A-Z]' '[a-z']' | sort | pbcopy
Whatever you do on the command line, you can put the output into the cut&paste buffer by ending the line with | pbcopy.

Paste into a pipeline:

What about the other way? Ever have some really great stuff in your cut&paste buffer but wish you could see it sorted?

pbpaste | sort
Here's a better one. How many times have you been looking at a huge Cisco router configuration and wished you could find all references to a certain IP address? I used to copy the configuration into my cut&paste buffer then paste it into NotePad or TextEdit, and use "find". However, sometimes I needed to do a complicate search that could only be done with egrep. Then I had to save the file and grep from the command line. Now its a lot more simple:

Find 10.1.10.1:

pbpaste | grep 10.1.10.1
or find 10.1.10.1 as a whole word, don't treat "." as a wildcard:
pbpaste | grep -F -w 10.1.10.1
or maybe we just want to count the number of lines:
pbpaste | grep -F -w 10.1.10.1 | wc -l

"sed" your cut&paste buffer:

Here's my favorite. Today I had the following string in my cut&paste buffer:

access-list 101 permit tcp object-group OSXservers any eq ftp
This is a rule for access list 101 on my PIX firewall. Now what I wanted to do is paste that into access list 202. Sure, I could retype it. I could even paste it without the ENTER at the end of the line, and use my cursor keys to get to to "101" and change it to "202". However, that's a pain and it is also error prone, epecially considering the way a PIX can mishandle command line editing on long lines leaving you without a clue about the real location of your cursor.

Therefore I did this instead:

pbpaste | sed -e 's/ 101 / 202 /g' | pbcopy
To test my work, I looked at the buffer:
$ pbpaste
access-list 202 permit tcp object-group OSXservers any eq ftp
It worked! W00t! Thus I pasted it into my PIX and was on my way.

More info:

The system is smart enough to tell ASCII text from RTF from EPS. The man page has more information.