<?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>Tuts4Tech &#187; bash</title>
	<atom:link href="http://tuts4tech.net/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuts4tech.net</link>
	<description>Tech Tutorials</description>
	<lastBuildDate>Sun, 18 Jul 2010 01:41:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Understanding and Preventing Fork Bombs</title>
		<link>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/</link>
		<comments>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:26:57 +0000</pubDate>
		<dc:creator>Duffy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Bomb]]></category>
		<category><![CDATA[Fork]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Reboot]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[System admin]]></category>

		<guid isPermaLink="false">http://tuts4tech.net/?p=595</guid>
		<description><![CDATA[A fork bomb is just a bash function that gets called recursively. Once a fork bomb is active on a machine it may not be able to preform normally until a reboot is made, as the only solution to the fork bomb is to kill all its processes. Bash Functions A fork bomb is really [...]]]></description>
			<content:encoded><![CDATA[<p>A fork bomb is just a bash function that gets called recursively. Once a fork bomb is active on a machine it may not be able to preform normally until a reboot is made, as the only solution to the fork bomb is to kill all its processes.</p>
<h3>Bash Functions</h3>
<p>A fork bomb is really just a bash function, below is an example of a bash function</p>
<pre class="brush: plain;">helloworld() {
echo hello world
};</pre>
<p>A fork bomb would be</p>
<pre class="brush: plain;">:(){
 :|:&amp;
};:</pre>
<p>Now to explain.<br />
:(){ - Creates the function<br />
:|: - Next it call itself using recursion and pipes the output to another call of the function<br />
&#038; - Puts the function call in the background so child cannot die<br />
}; - Terminate the function<br />
: - Call (run) the function</p>
<p>If you would like a more human readable fork bomb it would be as follows</p>
<pre class="brush: plain;">forkbomb(){
forkbomb | forkbomb &amp;
}; forkbomb</pre>
<h3>Preventing Fork Bombs</h3>
<p>We can prevent users from running fork bombs by limiting the amount of processes they are allowed to run.<br />
We can achive this using /etc/security/limits.conf</p>
<p>To get started open /etc/security/limits.conf</p>
<pre class="brush: plain;">nano /etc/security/limits.conf</pre>
<p>In my example I want to limit the user john to 300 processes and any users in the group of students to 250 processes. For this I would put the following into my config file</p>
<pre class="brush: plain;">john hard nproc 300
@students hard nproc 250</pre>
<p>Please keep in mind that KDE and Gnome desktop system can lanuch many processes.</p>
]]></content:encoded>
			<wfw:commentRss>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto Add time And Date To Your Bash History</title>
		<link>http://tuts4tech.net/2009/08/12/howto-add-time-and-date-to-your-bash-history/</link>
		<comments>http://tuts4tech.net/2009/08/12/howto-add-time-and-date-to-your-bash-history/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:00:27 +0000</pubDate>
		<dc:creator>Duffy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[searching]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://tuts4tech.net/?p=547</guid>
		<description><![CDATA[This comes in very handy if your trying to track back when you had last run something. To enable it just simply add export HISTTIMEFORMAT="%h/%d - %H:%M:%S " to your .bashrc file echo 'export HISTTIMEFORMAT=&#34;%h/%d - %H:%M:%S &#34;' &#62;&#62; ~/.bashrc Then reload your .bashrc source ~/.bashrc Now when you run history you should get a [...]]]></description>
			<content:encoded><![CDATA[<p>This comes in very handy if your trying to track back when you had last run something.<br />
To enable it just simply add export HISTTIMEFORMAT="%h/%d - %H:%M:%S " to your .bashrc file
<pre class="brush: plain;">echo 'export HISTTIMEFORMAT=&quot;%h/%d - %H:%M:%S &quot;' &gt;&gt; ~/.bashrc</pre>
<p>
Then reload your .bashrc
<pre class="brush: plain;">source ~/.bashrc</pre>
<p>
Now when you run history you should get a output similar to the one below
<pre class="brush: plain;">   502  Aug/12 - 13:48:31 tail -f /home/duffy/log/access.log
  503  Aug/12 - 13:49:01 echo hello
  504  Aug/12 - 13:49:24 more /var/log/syslog</pre>
<p></p>
<h2>Some other bash history tips</h2>
<p></p>
<ol>
<li>
The best way of finding something quickly in your bash history is simply by pressing ctrl+r and then typing out the start of the command it will auto complete it with any matches found in your bash history</li>
<p></p>
<li>If you don't want to save duplicate commands in your bash history simply add export HISTCONTROL=ignoreboth to your .bashrc
<pre class="brush: plain;">echo 'export HISTCONTROL=ignoreboth' &gt;&gt; ~/.bashrc</pre>
</li>
<p></p>
<li>If you want to change the lenght of history add export HISTSIZE=1000 to your .bashrc
<pre class="brush: plain;">echo 'export HISTSIZE=1000' &gt;&gt; ~/.bashrc</pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tuts4tech.net/2009/08/12/howto-add-time-and-date-to-your-bash-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating aliases in bash</title>
		<link>http://tuts4tech.net/2009/05/23/creating-aliases-in-bash/</link>
		<comments>http://tuts4tech.net/2009/05/23/creating-aliases-in-bash/#comments</comments>
		<pubDate>Sat, 23 May 2009 02:15:52 +0000</pubDate>
		<dc:creator>Duffy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aliases]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[long commands]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[time saving]]></category>

		<guid isPermaLink="false">http://tuts4tech.co.cc/?p=188</guid>
		<description><![CDATA[Are you tired off typing out full commands? if so aliases can save you time. They allow you to shorten long commands down into one word. To add a alias edit ~/.bashrc nano ~/.bashrc Then come to the bottom of that file and add your aliases like this: alias rm = &#34;rm -i&#34; alias lightyrestart [...]]]></description>
			<content:encoded><![CDATA[<p>Are you tired off typing out full commands? if so aliases can save you time. They allow you to shorten long commands down into one word. To add a alias edit ~/.bashrc</p>
<pre class="brush: plain;">nano ~/.bashrc</pre>
<p>
Then come to the bottom of that file and add your aliases like this:</p>
<pre class="brush: plain;">alias rm = &quot;rm -i&quot;
alias lightyrestart = &quot;/etc/init.d/lighttpd restart&quot;
alias server_name=&quot;ssh -v -l USERNAME IP ADDRESS&quot;</pre>
<p>Then Reload your .bashrc file and your aliases should be enabled</p>
<pre class="brush: plain;">source ~/.bashrc</pre>
]]></content:encoded>
			<wfw:commentRss>http://tuts4tech.net/2009/05/23/creating-aliases-in-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
