Bash and the Screen

Beauty and the Beast

When working in a UNIX/Linux/MacOSX environment, the command is often used to execute some tasks. The default shell in the (MacOSX) and in most other terminals, is the Bourne Again Shell aka bash.

Bash is intended to be a conformant implementation of the Shell and Utilities portion of the IEEE POSIX specification. Bash also incorporates useful features from the Korn and C shells (ksh and csh).

Screen is a full-screen text-based window manager with VT100/ANSI terminal emulation. It has the ability to detach shell sessions, which is extremely useful for executing remote processes or executing processes that should be terminated after log out or termination of the shell process itself.

my ~/.bashrc

First we start off with configuration the Bash configuration file, which is located at ~/.bashrc for the current user or at /etc/bashrc.bashrc for system-wide configurations.

Most users will just edit their own bashrc file.
The options defined in this file, have comments above them so I won’t re-explain them.

This local bashrc file enables some default settings and creates a fancy bash prompt in colour. (See screenshot)

Screen Shell Prompt

Next we’ll set up the Screen configuration file.

my ~/.screenrc

The following Screen configuration file sets some options that I find useful. These options included:

  • no splash screen at startup
  • no visual bell
  • a customized status bar at the bottom of the screen
  • a huge scrollback buffer
  • updated window names, based on the current command
  • UTF8 encoding

The file will be saved in the user home directory, at ~/.screenrc

In order to have updated window names, it is important that the above Bash configuration regarding the PS1 variable, has been enabled. If not, then there will be no updated window names!

This configuration file was used to create the following screenshot:
Screenshot Screen with 3 open windows


Some options were taken out of the Byobu configuration file, others were found on the Interweb.


Bash and the Screen — 2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *