OSL 10 logo

Oregon State University Open Source Lab

Build The Future

The Open Source Lab is an organization working for the advancement of open source technologies.

The lab provides hosting for more than 160 projects, including those of worldwide leaders like the Apache Software Foundation, the Linux Foundation and Drupal. Together, the OSL’s hosted sites deliver nearly 430 terabytes of information every month to people around the world.

Make Bash, Not War

At the OSL we have shared workstations, most of which are named after colors. In the NOC, I usually work at emerald.workstation.osuosl.bak (Figure 1). I use tmux (Figure *) to multiplex so I can have multiple terminals open in a single ssh connection and connect to my session from anywhere. When splitting the terminal vertically, the prompt can get so long that it's hard to see the command that I'm entering (Figure 2). I'd like my prompt to automatically shorten itself in narrow windows. Fortunately, my terminal already knows how much space it has available: $COLUMNS is an environment variable which stores how wide your current terminal is, and the default unixism is 80. So in order to save space, I'd like to shorten my prompt to only a directory listing and a colored character replacing the normal $ or >.

Behold! (Figure 3, 4)

Read more