Distractions and Truth In My Shell Prompt

Tags: devops

My shell prompt doesn’t lie.

I’m a bash user, so I can set $PS1 to contain a variety of useful information, and my prompt will vary depending on where I’m at. We have enough servers and services at $DAYJOB that the following makes a lot of sense:

\u@\h (\t) $

That prints:

USERNAME@HOSTNAME (TIMESTAMP) $

You can learn all about the various bash shell escape sequences if you’d like.

People tell me that showing the time is silly. I like it because there are times when I run a long running process and walk away while it churns. It’s often helpful to know how long something took, and having timestamps on each line let me know.

It’s helpful to me personally as well. There are many times when I’m drawn away from scheduled work into an urgent support situation, and I’ll leave my scheduled work as-is and work the urgent situation in a new terminal tab or window. That’s exactly what happened today, and I was a little shocked at the story the timestamps had to tell:

tfreund@somehost (10:28:15) $ the_last_command_i_ran_that_you_dont_care_about.sh
tfreund@somehost (10:28:20) $ the_first_command_i_ran_after_getting_back_at_it.sh
tfreund@somehost (14:38:31) $

Over four hours. I’ll admit that wasn’t all urgent support. I ate lunch and checked email, too. It took a look at my important task list to jog my memory back to the work I was doing at 10:28. “Oh, right, that’s what I really need to finish today.”

Working for 8 solid hours is an illusion. It’s not going to happen. Unless work happens in a cabin off the grid away from civilization, interruptions will wreck your day. Almost every day. More important than blocking off 8 solid hours is to put in place systems to continually nudge ourselves toward the important tasks once the storms of unavoidable urgent work have passed.

My favorites include: