GNU Screen Profiles

If you're a regular GNU Screen user might find this hack for creating profiles useful.

  1. Create a .screen directory in your home directory.

    mkdir "$HOME/.screen"
    
  2. Add the following to your .bashrc or .bash_profile.

    sp() {
      if [[ -f "$HOME/.screen/$1" ]]; then
        screen -c "$HOME/.screen/$1"
      else
        echo "Unknown screen profile '$1'."
      fi  
    }
    
  3. Create a file in the ~/.screen directory with whatever profile name you would like to use (below is a sample profile named tyrion).

    You should copy the first line into each profile as it loads your default GNU Screen settings.

    source "$HOME/.screenrc"
    
    chdir "$HOME/src/tyrion/src"
    screen -t code  0
    
    chdir "$HOME/src/tyrion"
    screen -t build  1
    
    chdir "$HOME/src/tyrion/tests"
    screen -t tests  2
    
    chdir "$HOME/src/tyrion"
    
  4. Reload your shell and test your profile (replace tyrion with whatever name you picked).

    [silas@example ~]$ sp tyrion
    

Licensing information is available on the about page, for additional questions or comments feel free to contact me.