<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Screen &#8211; Johnny Morano&#039;s Tech Articles</title>
	<atom:link href="https://jmorano.moretrix.com/tag/screen/feed/" rel="self" type="application/rss+xml" />
	<link>https://jmorano.moretrix.com</link>
	<description>Ramblings of an old-fashioned space cowboy</description>
	<lastBuildDate>Tue, 04 Sep 2012 06:43:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://jmorano.moretrix.com/wp-content/uploads/2022/04/cropped-jmorano_emblem-32x32.png</url>
	<title>Screen &#8211; Johnny Morano&#039;s Tech Articles</title>
	<link>https://jmorano.moretrix.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Bash and the Screen</title>
		<link>https://jmorano.moretrix.com/2011/03/bash-and-the-screen/</link>
					<comments>https://jmorano.moretrix.com/2011/03/bash-and-the-screen/#comments</comments>
		
		<dc:creator><![CDATA[insaniac]]></dc:creator>
		<pubDate>Tue, 08 Mar 2011 13:17:03 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[UNIX]]></category>
		<guid isPermaLink="false">http://jmorano.moretrix.com/?p=522</guid>

					<description><![CDATA[Beauty and the Beast When working in a UNIX/Linux/MacOSX environment, the command is often used to execute some&#8230;]]></description>
										<content:encoded><![CDATA[<h3>Beauty and the Beast</h3>
<p>When working in a UNIX/Linux/MacOSX environment, the command is often used to execute some tasks. The default shell in the <a href="http://en.wikipedia.org/wiki/Apple_Terminal">Terminal.app</a> (MacOSX) and in most other terminals, is the <a href="http://www.gnu.org/software/bash/">Bourne Again Shell</a> aka bash.</p>
<p>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).</p>
<p><a href="http://www.gnu.org/software/screen/">Screen</a> 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.<br />
<span id="more-522"></span></p>
<h3>my ~/.bashrc</h3>
<p>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. </p>
<p>Most users will just edit their own bashrc file.<br />
The options defined in this file, have comments above them so I won&#8217;t re-explain them.</p>
<pre class="brush:bash">
# define your local timezone
export TZ='Europe/Brussels'

# If not running interactively, don't do anything
[ -z "$PS1" ] &amp;&amp; return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] &amp;&amp; eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] &amp;&amp; [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# define all aliases in a separate file
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# turn on bash completion, must be installed separately
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

# define some colors which will be used in PS1 and PS2
BLUE="[�33[0;34m]"
LIGHT_GRAY="[�33[0;37m]"
GREEN="[�33[0;32m]"
LIGHT_BLUE="[�33[1;34m]"
LIGHT_CYAN="[�33[1;36m]"
YELLOW="[�33[1;33m]"
WHITE="[�33[1;37m]"
RED="[�33[0;31m]"
NO_COLOUR="[�33[0m]"

# if this shell was started in the screen command, use a different PS1 prompt
if [[ $TERM =~ screen ]] ; then
    PS1="${GREEN}.oO( $BLUEh $GREEN|$BLUE w $GREEN)Oo"'[�33k][�33\]'".$NO_COLOUR "
else
    PS1="${GREEN}.oO( $BLUEh $GREEN|$BLUE w $GREEN)Oo.$NO_COLOUR "
fi
PS2="$GREEN.oO($NO_COLOUR "</pre>
<p>This local bashrc file enables some default settings and creates a fancy bash prompt in colour. (See screenshot)</p>
<p><img decoding="async" src="https://jmorano.moretrix.com/wp-content/uploads/2011/03/Screenshot-insaniac@musashi.moretrix.com-home-insaniac-1.png" alt="Screen Shell Prompt" /></p>
<p>Next we&#8217;ll set up the Screen configuration file.</p>
<h3>my ~/.screenrc</h3>
<p>The following Screen configuration file sets some options that I find useful. These options included:</p>
<ul>
<li>no splash screen at startup</li>
<li>no visual bell</li>
<li>a customized status bar at the bottom of the screen</li>
<li>a huge scrollback buffer</li>
<li>updated window names, based on the current command</li>
<li>UTF8 encoding</li>
</ul>
<p>The file will be saved in the user home directory, at ~/.screenrc</p>
<pre class="brush:bash">
# some default settings
startup_message off
vbell off
msgwait 1
defutf8 on
compacthist on

# Monitor windows
defmonitor on
activity ""

# Turns off alternate screen switching in xterms,
# so that text in screen will go into the xterm's scrollback buffer:
termcapinfo xterm* ti@:te@
altscreen on

# Enable 256 color terminal
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=E[48;5;%dm:AF=E[38;5;%dm'
defbce "on"

# Log 10000 lines
defscrollback 50000

backtick 2 60 60 echo $USERNAME

screen 0

shelltitle '. |bash'
hardstatus alwayslastline '%{= .y}.oO(%{= .b}%2`@%H%{= .y})Oo. %{= .b}%{+} %= %-w %{= .yb} %n:[%t] %{= db} %+w %{= .y}time: [%c]'

bindkey -k k2 screen                                    # F2  | Create new window
bindkey -k k3 prev                                      # F3  | Previous Window
bindkey -k k4 next                                      # F4  | Next Window
register r "^a:source $HOME/.screenrc^M"                #     | Goes with F5 definition
bindkey -k k5 process r                                 # F5  | Reload profile
bindkey -k k6 detach                                    # F6  | Detach from this session
bindkey -k k7 copy                                      # F7  | Enter copy/scrollback mode
register t "^aA^aa^k^h"                                 #     | Goes with the F8 definition
bindkey -k k8 process t                                 # F8  | Re-title a window
</pre>
<p>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!</p>
<p>This configuration file was used to create the following screenshot:<br />
<img decoding="async" src="https://jmorano.moretrix.com/wp-content/uploads/2011/03/Screenshot-johnny@ubuntu-sunray1-Dev-Elop.png" alt="Screenshot Screen with 3 open windows" /></p>
<h3>References</h3>
<p>Some options were taken out of the <a href="https://launchpad.net/byobu">Byobu</a> configuration file, others were found on the <a href="http://www.google.com/">Interweb</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://jmorano.moretrix.com/2011/03/bash-and-the-screen/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
