<?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>&#60;SourceBench/&#62; Your place to share code stuff &#187; Bash/shell</title>
	<atom:link href="http://sourcebench.com/category/languages/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://sourcebench.com</link>
	<description></description>
	<lastBuildDate>Tue, 04 May 2010 07:57:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple parallel processing with Bash using &#8220;wait&#8221; and &#8220;jobs&#8221;</title>
		<link>http://sourcebench.com/languages/bash/simple-parallel-processing-with-bash-using-wait-and-jobs/</link>
		<comments>http://sourcebench.com/languages/bash/simple-parallel-processing-with-bash-using-wait-and-jobs/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 13:53:14 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[threading]]></category>
		<category><![CDATA[wait]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/simple-parallel-processing-with-bash-using-wait-and-jobs/</guid>
		<description><![CDATA[#!/bin/bash
# this is a simple helper script that can be used when you are in need of running multiple processes at once
# simply run your command with an ampersand at the end and after this
# execute forky with the number of parallel processes as argument.

function forky() {
	local num_par_procs
	if [[ -z $1 ]] ; then
		num_par_procs=3
	else
		num_par_procs=$1
	fi

	while [[ [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">#!/bin/bash
# this is a simple helper script that can be used when you are in need of running multiple processes at once
# simply run your command with an ampersand at the end and after this
# execute forky with the number of parallel processes as argument.

function forky() {
	local num_par_procs
	if [[ -z $1 ]] ; then
		num_par_procs=3
	else
		num_par_procs=$1
	fi

	while [[ $(jobs | wc -l) -ge $num_par_procs ]] ; do
		sleep 1
	done
}

# below is an example - make sure to change this to your needs
for fname in `ls -1`; do
	echo &quot;`jobs | wc -l` jobs in spool&quot;
	echo -e &quot;processing $fname\n&quot;
	# below should be the command you like to execute. in this example it's a php script that would do something with a file.
	# important is the &amp; at the end of the command which sends the command to the background
	php ~/a_script_that_does_something_with_the_file --file=$fname &amp;
	# after this call the forky function with the amount of parallel processes as parameter
	forky 5
done

wait</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/simple-parallel-processing-with-bash-using-wait-and-jobs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Test if a nameserver change is done right</title>
		<link>http://sourcebench.com/languages/bash/test-if-a-nameserver-change-is-done-right/</link>
		<comments>http://sourcebench.com/languages/bash/test-if-a-nameserver-change-is-done-right/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 23:52:28 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[nameserver]]></category>
		<category><![CDATA[ns]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/test-if-a-nameserver-change-is-done-right/</guid>
		<description><![CDATA[# imagine you just updated your whois data so it will point your domain to an other nameserver and you want to know if that worked out
# this little command lets you know on *nix based machines
for i in a b c d e f g h i j k l; do dig +short ns [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;"># imagine you just updated your whois data so it will point your domain to an other nameserver and you want to know if that worked out
# this little command lets you know on *nix based machines
for i in a b c d e f g h i j k l; do dig +short ns domainname.com @$i.GTLD-SERVERS.NET; done</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/test-if-a-nameserver-change-is-done-right/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>command line real-time view of what files Time Machine is copying</title>
		<link>http://sourcebench.com/languages/bash/command-line-real-time-view-of-what-files-time-machine-is-copying/</link>
		<comments>http://sourcebench.com/languages/bash/command-line-real-time-view-of-what-files-time-machine-is-copying/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 09:15:51 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[time machine]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/command-line-real-time-view-of-what-files-time-machine-is-copying/</guid>
		<description><![CDATA[sudo fs_usage -w -f filesys backupd &#124; grep open]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">sudo fs_usage -w -f filesys backupd | grep open</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/command-line-real-time-view-of-what-files-time-machine-is-copying/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Print the number of established and listening connections to your server on port 80 per each IP address</title>
		<link>http://sourcebench.com/languages/bash/print-the-number-of-established-and-listening-connections-to-your-server-on-port-80-per-each-ip-address/</link>
		<comments>http://sourcebench.com/languages/bash/print-the-number-of-established-and-listening-connections-to-your-server-on-port-80-per-each-ip-address/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 23:49:27 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[connections]]></category>
		<category><![CDATA[listening]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[ports]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/print-the-number-of-established-and-listening-connections-to-your-server-on-port-80-per-each-ip-address/</guid>
		<description><![CDATA[netstat -plan&#124;grep :80&#124;grep -E &#34;(EST&#124;LIST)&#34;&#124;awk {'print $5'}&#124;cut -d: -f 1&#124;sort&#124;uniq -c&#124;sort -nk 1]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">netstat -plan|grep :80|grep -E &quot;(EST|LIST)&quot;|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/print-the-number-of-established-and-listening-connections-to-your-server-on-port-80-per-each-ip-address/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get a list of urls/domains from a text file</title>
		<link>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/</link>
		<comments>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 23:05:54 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/</guid>
		<description><![CDATA[sed 's/http/\^http/g' FILENAME &#124; tr -s &#34;^&#34; &#34;\n&#34; &#124; grep http&#124; sed 's/[\ &#124;\\\&#124;\&#34;].*//g' &#124; sed &#34;s/['].*//g&#34; &#124; sort &#124; uniq]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">sed 's/http/\^http/g' FILENAME | tr -s &quot;^&quot; &quot;\n&quot; | grep http| sed 's/[\ |\\\|\&quot;].*//g' | sed &quot;s/['].*//g&quot; | sort | uniq</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Start an application from the command line in OSX</title>
		<link>http://sourcebench.com/languages/bash/start-an-application-from-the-command-line-in-osx/</link>
		<comments>http://sourcebench.com/languages/bash/start-an-application-from-the-command-line-in-osx/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 22:03:57 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[launch application]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/start-an-application-from-the-command-line-in-osx/</guid>
		<description><![CDATA[# use open -a followed by the program name and optionally a file name for an output log file
open -a /Applications/TextEdit.app logfile.txt]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;"># use open -a followed by the program name and optionally a file name for an output log file
open -a /Applications/TextEdit.app logfile.txt</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/start-an-application-from-the-command-line-in-osx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Socks5 Proxy connection with SSH</title>
		<link>http://sourcebench.com/languages/bash/simple-socks5-proxy-connection-with-ssh/</link>
		<comments>http://sourcebench.com/languages/bash/simple-socks5-proxy-connection-with-ssh/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 21:49:10 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[socks5]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/simple-socks5-proxy-connection-with-ssh/</guid>
		<description><![CDATA[# Sometimes you want to get a simple proxy to fake your IP or encrypt your connection
# in case you are surfing in an insecure space. All you need is a server which you can access via ssh.
# then use the following command to open a ssh proxy connection with this command
ssh -ND 9999 your_user@your_ssh_remote_host
# [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;"># Sometimes you want to get a simple proxy to fake your IP or encrypt your connection
# in case you are surfing in an insecure space. All you need is a server which you can access via ssh.
# then use the following command to open a ssh proxy connection with this command
ssh -ND 9999 your_user@your_ssh_remote_host
# after this you will have SOCKS5 server on localhost port 9999 which you can enter as your browser proxy</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/simple-socks5-proxy-connection-with-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Download (mirror) an entire website with wget</title>
		<link>http://sourcebench.com/languages/bash/download-mirror-an-entire-website-with-wget/</link>
		<comments>http://sourcebench.com/languages/bash/download-mirror-an-entire-website-with-wget/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:30:10 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/download-mirror-an-entire-website-with-wget/</guid>
		<description><![CDATA[wget \
     --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains website.org \
     --no-parent \
     [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">wget \
     --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains website.org \
     --no-parent \
         <a href="http://www.website.org/tutorials/html/" rel="nofollow">http://www.website.org/tutorials/html/</a>
# found at <a href="http://www.linuxjournal.com/content/downloading-entire-web-site-wget" rel="nofollow">http://www.linuxjournal.com/content/downloading-entire-web-site-wget</a></pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/download-mirror-an-entire-website-with-wget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search for a function definition in a bunch of php files</title>
		<link>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/</link>
		<comments>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 13:40:08 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/</guid>
		<description><![CDATA[find . -name *.php -exec grep -HE &#34;function FUNCTION_NAME&#34; {} \;]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">find . -name *.php -exec grep -HE &quot;function FUNCTION_NAME&quot; {} \;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a self signed SSL Certificate (server.key/pem/csr/crt file)</title>
		<link>http://sourcebench.com/languages/bash/sourcecode-languagebashthe-followi/</link>
		<comments>http://sourcebench.com/languages/bash/sourcecode-languagebashthe-followi/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 03:36:45 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[crt]]></category>
		<category><![CDATA[csr]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://sourcebench.com/?p=9</guid>
		<description><![CDATA[#The following commands will generate you server.key/pem/csr/crt files, needed for working with apache/ssl on port 443. You can replace -days #365 with any value you want.
openssl genrsa -des3 -rand file1:file2:file3:file4:file5 -out server.key 1024
openssl rsa -in server.key -out server.pem
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
#If you [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">#The following commands will generate you server.key/pem/csr/crt files, needed for working with apache/ssl on port 443. You can replace -days #365 with any value you want.
openssl genrsa -des3 -rand file1:file2:file3:file4:file5 -out server.key 1024
openssl rsa -in server.key -out server.pem
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
#If you plan using valid SSL certificate, signed by thawte for example, then when entering data for creating .csr file, you have to enter valid data, #and then send this file to them. They will return the .crt file.</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/sourcecode-languagebashthe-followi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
