<?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>MrBrown blob &#187; shell</title>
	<atom:link href="http://charles.lescampeurs.org/tag/shell/feed" rel="self" type="application/rss+xml" />
	<link>http://charles.lescampeurs.org</link>
	<description>random bits.</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:34:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Set Terminal tab title in Mac OS X</title>
		<link>http://charles.lescampeurs.org/2009/08/11/set-terminal-tab-title-in-mac-os-x?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=set-terminal-tab-title-in-mac-os-x</link>
		<comments>http://charles.lescampeurs.org/2009/08/11/set-terminal-tab-title-in-mac-os-x#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:12:07 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Command line]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=195</guid>
		<description><![CDATA[I wrote previously a how-to to set your iTerm tab title. I finally found a tool to do the same thing with the default Mac OS X Terminal. Check it out here, it works perfectly for me!  link is dead. On my Mac OS X 10.6.6 and bash (3.2.48(1)-release), you can set your tab title [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-196" title="Picture 2" src="http://charles.lescampeurs.org/wp-content/uploads/2009/08/Picture-2.png" alt="Picture 2" width="209" height="84" /></p>
<p>I wrote previously a how-to to <a href="http://charles.lescampeurs.org/2008/05/07/automatically-set-title-on-iterm-tabs" target="_blank">set your iTerm tab title</a>.</p>
<p>I finally found a tool to do the same thing with the default Mac OS X Terminal.</p>
<p><strike>Check it out <a href="http://purpleamy.com/magicwrap/" target="_blank">here</a>, it works perfectly for me!</strike>  link is dead.</p>
<p>On my Mac OS X 10.6.6 and bash (3.2.48(1)-release), you can set your tab title with the PROMPT_COMMAND variable as follow:</p>
<p>export PROMPT_COMMAND=’echo -ne “\033]0;${USER}@${HOSTNAME%%.*}\007″‘</p>
<p>Add this to your <em>.bashrc</em> or <em>/etc/profile</em> file and you&#8217;re done <img src='http://charles.lescampeurs.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=195" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2009/08/11/set-terminal-tab-title-in-mac-os-x/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Memory usage by group of processes</title>
		<link>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=memory-usage-by-group-of-processes</link>
		<comments>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes#comments</comments>
		<pubDate>Fri, 13 Mar 2009 14:14:26 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Benchmarks]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=173</guid>
		<description><![CDATA[While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage. Playing with memory_limit in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk. First, get the number of php running processes: # ps aux &#124; grep php-cgi &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage.</p>
<p>Playing with <em>memory_limit</em> in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk.</p>
<p>First, get the number of php running processes:</p>
<pre># ps aux | grep php-cgi | grep -v grep | wc -l
126</pre>
<p>Then, use awk to calculate the average memory usage for these processes:</p>
<pre># ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s/126;}'
33987.8</pre>
<p>The number used in the calculation is the field RSS given by ps. The ps manual page says:</p>
<blockquote><p>rss: resident set size, the non-swapped physical memory that a task has used (in kiloBytes)</p></blockquote>
<p>You can also calculate the total memory used by all php-cgi processes:</p>
<pre># ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s;}'
4302028</pre>
<p>If you need to watch the trend of this average memory usage, a little shell loop does the trick:</p>
<pre># while [ 1 ]; do ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s/126;}'; sleep 2; done
34401.3
34405.1
34408.4
34409.4
34414.2
34417</pre>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=173" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The unix touch command</title>
		<link>http://charles.lescampeurs.org/2008/09/11/the-unix-touch-command?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-unix-touch-command</link>
		<comments>http://charles.lescampeurs.org/2008/09/11/the-unix-touch-command#comments</comments>
		<pubDate>Thu, 11 Sep 2008 05:30:19 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Command line]]></category>
		<category><![CDATA[coretutils]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=53</guid>
		<description><![CDATA[This post is a quick ref on the linux touch command. All the examples have been tested on Linux. This command is used to update the access and modification times of files. touch&#8217;s syntax touch [option] file_name(s) touch file1 file2 file3 Here some examples: # touch /tmp/file # ls -l /tmp/file rw-r--r-- 1 charlybr charlybr [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a quick ref on the linux touch command. All the examples have been tested on Linux.</p>
<p>This command is used to update the access and modification times of files.</p>
<ul>
<li>touch&#8217;s syntax</li>
</ul>
<pre>touch [option] file_name(s)
touch file1 file2 file3</pre>
<ul>
<li>Here some examples:</li>
</ul>
<pre># touch /tmp/file
# ls -l /tmp/file
rw-r--r-- 1 charlybr charlybr 0 Sep 10 16:13 /tmp/file</pre>
<ul>
<li>Update access and modification time to current time:</li>
</ul>
<pre># ls -l /tmp/file
rw-r--r-- 1 charlybr charlybr 0 Sep 10 16:13 /tmp/file
# touch /tmp/file
# ls -l /tmp/file
rw-r--r-- 1 charlybr charlybr 0 Sep 10 16:14 /tmp/file</pre>
<ul>
<li>Update access and modification time to a specified timestamp ([[CC]YY]MMDDhhmm[.ss] format):</li>
</ul>
<pre># touch -t 09091842 /tmp/file
# ls -l /tmp/file
-rw-r--r-- 1 charlybr charlybr 0 Sep  9 18:42 /tmp/file</pre>
<ul>
<li>Update access and modification time to a specified date</li>
</ul>
<pre># touch -d '9 Sep' /tmp/file
# ls -l /tmp/file
-rw-r--r-- 1 charlybr charlybr 0 Sep  9 00:00 /tmp/file
# touch -d '9 Sep 2008 13:14' /tmp/file
# ls -l /tmp/file
-rw-r--r-- 1 charlybr charlybr 0 Sep  9 13:14 /tmp/file</pre>
<h2>Links</h2>
<ul>
<li>touch is part of the <a title="Coreutils package" href="http://www.gnu.org/software/coreutils/" target="_blank">Coreutils</a> package</li>
<li><a title="touch documentation page" href="http://www.gnu.org/software/coreutils/manual/html_node/touch-invocation.html#touch-invocation" target="_blank">touch documentation page</a></li>
<li><a title="touch man page on FreeBSD" href="http://www.freebsd.org/cgi/man.cgi?query=touch&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+7.0-RELEASE&amp;format=html" target="_blank">man page on FreeBSD</a></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=53" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/09/11/the-unix-touch-command/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>sudo: port: command not found</title>
		<link>http://charles.lescampeurs.org/2008/08/05/sudo-port-command-not-found?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sudo-port-command-not-found</link>
		<comments>http://charles.lescampeurs.org/2008/08/05/sudo-port-command-not-found#comments</comments>
		<pubDate>Tue, 05 Aug 2008 10:28:33 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=43</guid>
		<description><![CDATA[On MacOSX, if you have installed macports with the package installer, you may encounter the sudo: port: command not found problem. Macports binaries are installed in /opt/local/bin, so you just need to add this path to your PATH environment variable. Example with your user, add to your $HOME/.profile : export PATH=$PATH:/opt/local/bin You can source your [...]]]></description>
			<content:encoded><![CDATA[<p>On MacOSX, if you have installed <a title="MacPorts" href="http://www.macports.org/" target="_blank">macports</a> with the package installer, you may encounter the <em>sudo: port: command not found</em> problem.</p>
<p>Macports binaries are installed in <em>/opt/local/bin</em>, so you just need to add this path to your PATH environment variable. Example with your user, add to your <em>$HOME/.profile</em> :</p>
<pre>export PATH=$PATH:/opt/local/bin</pre>
<p>You can source your profile file to update your environment:</p>
<pre>$ source .profile</pre>
<p>You are now able to use the port command:</p>
<pre>$ sudo port -v selfupdate</pre>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=43" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/08/05/sudo-port-command-not-found/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

