<?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>UnixNewbie.org &#187; Cheat Sheets</title>
	<atom:link href="http://www.unixnewbie.org/category/server-admin-tips/cheat-sheets/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unixnewbie.org</link>
	<description></description>
	<lastBuildDate>Mon, 30 Nov 2009 16:58:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Iptables cheat sheet</title>
		<link>http://www.unixnewbie.org/iptables-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/iptables-cheat-sheet/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 16:39:50 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=1139</guid>
		<description><![CDATA[Iptables is a Linux kernel-level module allowing us to perform various networking manipulations (i.e. packet filtering) to achieve better network security...]]></description>
			<content:encoded><![CDATA[<p>Iptables is a Linux kernel-level module allowing us to perform various networking manipulations (i.e. packet filtering) to achieve better network security.</p>
<p>Here are some iptables commands I have found useful.  This list will be updated from time to time.</p>
<p><strong>View all current iptables rules:</strong></p>
<pre>iptables -L -v</pre>
<p>&nbsp;</p>
<p><strong>View all INPUT rules:</strong></p>
<pre>iptables -L INPUT -nv</pre>
<p>&nbsp;</p>
<p><strong>How to block an IP address using iptables:</strong></p>
<pre>iptables -I INPUT -s "201.128.33.200" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>To block a range of IP addresses:</strong></p>
<pre>iptables -I INPUT -s "201.128.33.0/24" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to unblock an IP address:</strong></p>
<pre>iptables -D INPUT -s "201.128.33.200" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to block all connections to a port:</strong><br />
To block port 25:</p>
<pre>iptables -A INPUT -p tcp --dport 25 -j DROP
iptables -A INPUT -p udp --dport 25 -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to un-block:</strong><br />
To enable port 25:</p>
<pre>iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -p udp --dport 25 -j ACCEPT </pre>
<p>&nbsp;</p>
<p><strong>To save all rules so that they are not lost in case of a server reboot:</strong></p>
<pre>/etc/init.d/iptables save</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/iptables-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exim Cheatsheet</title>
		<link>http://www.unixnewbie.org/exim-cheatsheet/</link>
		<comments>http://www.unixnewbie.org/exim-cheatsheet/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:31:23 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=920</guid>
		<description><![CDATA[Exim is the widely used open source mail transfer agent. It is responsible for routing, delivering, and receiving email messages.]]></description>
			<content:encoded><![CDATA[<p>Exim is the widely used open source mail transfer agent.  It is responsible for routing, delivering, and receiving email messages.  Here are some of my favorite, <strong>useful exim commands via shell</strong>.</p>
<p>&nbsp;</p>
<p>This command will show exim processes including the path to the script being utilized to send mail. Very useful in locating a spamming script:</p>
<pre>ps -C exim -fH eww</pre>
<p>&nbsp;<br />
<br />
This will show the route of the email address.  It is useful when you try to diagnose email delivery problems:</p>
<pre>exim -bt user@domain.com</pre>
<p>&nbsp;<br />
<br />
To perform a SMTP testing session as if the mail comes from a particular host for testing filtering rules inside your server:</p>
<pre>exim -bh ipaddresshere</pre>
<p>&nbsp;<br />
<br />
This will show what exim is currently doing:</p>
<pre>exiwhat</pre>
<p>&nbsp;<br />
<br />
Mail server queue:</p>
<pre>exim -bpc &nbsp; // print the total number of emails currently in server queue.
exim -bp &nbsp; // print mails in queue sorting by time, size,...
exim -bp | exiqsumm &nbsp; // count, volume, oldest, newest, domain, and totals
</pre>
<p>&nbsp;<br />
<br />
To list exim&#8217;s configuration setting:</p>
<pre>exim -bP</pre>
<p>&nbsp;<br />
<br />
To start a queue run:</p>
<pre>exim -q -v</pre>
<p>&nbsp;<br />
<br />
To start a queue run for just local deliveries:</p>
<pre> exim -ql -v</pre>
<p>&nbsp;<br />
<br />
To remove a message from the queue:</p>
<pre>exim -Mrm &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To freeze a message:</p>
<pre>exim -Mf &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To force delivery of a message:</p>
<pre>exim -M &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To remove all frozen messages:</p>
<pre>exiqgrep -z -i | xargs exim -Mrm</pre>
<p>&nbsp;<br />
<br />
To remove all messages older than 1 day (the number is in seconds):</p>
<pre>exiqgrep -o 86400 -i | xargs exim -Mrm</pre>
<p>&nbsp;<br />
<br />
To freeze all queued mail from a given sender:</p>
<pre>exiqgrep -i -f user@domain.com | xargs exim -Mf</pre>
<p>&nbsp;<br />
<br />
Message viewing:</p>
<pre>exim -Mvh &lt;message-id&gt;  &nbsp; // view message's headers
exim -Mvb &lt;message-id&gt;  &nbsp; // view message's body
exim -Mvl &lt;message-id&gt;  &nbsp; // view message's logs</pre>
<p>&nbsp;<br />
</p>
<h2>Exiqgrep</h2>
<p>At times, we will be required to search the mail queue for a particular message to help troubleshooting mail problems for our users.  Here are some useful <a href="http://www.exim.org/exim-html-4.50/doc/html/spec_49.html#IX2895" target=_blank>exiqgrep</a> commands.</p>
<p>&nbsp;<br />
This will search the queue for messages coming from a specific sender:</p>
<pre>exiqgrep -f user@domain.com</pre>
<p>&nbsp;<br />
<br />
This will search the queue for messages from a specific recipient:</p>
<pre>exiqgrep -r user@domain.com</pre>
<p>&nbsp;<br />
<br />
This will display messages older than the specified number of seconds. </p>
<pre>exiqgrep -o 86400  &nbsp; // more than a day old</pre>
<p>&nbsp;<br />
<br />
This will display messages newer than the specified number of seconds. </p>
<pre>exiqgrep -y 3600  &nbsp; // less than an hour old</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/exim-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu LAMP cheat sheet</title>
		<link>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 14:45:34 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=990</guid>
		<description><![CDATA[LAMP: the server software bundle consists of Linux - Apache - MySQL - PHP; Linux: operating system; Apache: http server; MySQL: database software; PHP: scripting language]]></description>
			<content:encoded><![CDATA[<p>LAMP: the server software bundle consists of Linux &#8211; Apache &#8211; MySQL &#8211; PHP; Linux: operating system; Apache: http server; MySQL: database software; PHP: scripting language</p>
<p>&nbsp;</p>
<h2>Location, configuration file:</h2>
<p>&nbsp;<br />
<strong>Apache configuration file:</strong></p>
<pre>/etc/apache2/apache2.conf</pre>
<p>&nbsp;<br />
<strong>PHP php.ini file:</strong></p>
<pre>/etc/php5/apache2/php.ini</pre>
<p>&nbsp;<br />
<strong>MySQL configuration file:</strong></p>
<pre>/etc/mysql/my.cnf</pre>
<p>&nbsp;<br />
<strong>Default (initial) web location:</strong></p>
<pre>/var/www</pre>
<p>&nbsp;<br />
<strong>Web browser address:</strong></p>
<pre>http://localhost/</pre>
<p>&nbsp;</p>
<h2>Restarting:</h2>
<p>&nbsp;<br />
<strong>How to restart apache:</strong></p>
<pre>sudo /etc/init.d/apache2 restart</pre>
<p>&nbsp;<br />
<strong>How to restart MySQL:</strong></p>
<pre>sudo /etc/init.d/mysql restart</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix FIND command cheat sheet</title>
		<link>http://www.unixnewbie.org/unix-find-command-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/unix-find-command-cheat-sheet/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 22:56:45 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=968</guid>
		<description><![CDATA["find" is a Unix command allowing us to search for files within our Unix/Linux operating system.  "find" can search for files based on name, type, size, modified date, etc...  I often use "find" to locate bad files within a hacked system/account.  ]]></description>
			<content:encoded><![CDATA[<p>&#8220;find&#8221; is a Unix command allowing us to search for files within our Unix/Linux operating system.  &#8220;find&#8221; can search for files based on name, type, size, modified date, etc&#8230;  I often use &#8220;find&#8221; to locate bad files within a hacked system/account.  </p>
<p>&nbsp;<br />
<br />&nbsp;<br />
<strong>To search for files by name:</strong></p>
<pre>find dir -name keyword</pre>
<p>dir: directory you want to search for files<br />
keyword: the name of the file you want to search for<br />
<u>examples: </u><br />
<em>find /home/test -name &#8220;index.txt&#8221;</em><br />
<em>find /home -name &#8220;shell*&#8221;</em>  &nbsp; // find files beginging with &#8220;shell&#8221;</p>
<p>&nbsp;<br />
<strong>To search for files by modified date:</strong><br />
<br />
<u>by the minute:</u></p>
<pre>find dir -mmin time</pre>
<p>&nbsp;<br />
<u>by the hour:</u></p>
<pre>find dir -mtime time</pre>
<p>&nbsp;<br />
<u>examples:</u><br />
<em>find /home -mmin -30</em>  &nbsp; // find all files modified in the past 30 minutes<br />
<em>find /home -mmin +30</em>  &nbsp; // find all files modified more than 30 minutes ago<br />
<em>find /home -mmin +30 -mmin -60</em>  &nbsp; // find all files modified between 30 and 60 minutes ago<br />
<em>find /home -mtime -1</em> &nbsp; // find all files modified within the past 1-day (24 hours)<br />
<em>find /home -mtime -7</em> &nbsp; // find all files modified within the past 1-week (7 days)</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/unix-find-command-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RPM cheat sheet</title>
		<link>http://www.unixnewbie.org/rpm-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/rpm-cheat-sheet/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 19:47:36 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=926</guid>
		<description><![CDATA[RPM cheat sheet]]></description>
			<content:encoded><![CDATA[<p>RPM is the package manager for the following Linux Operating Systems: RedHat, CentOS, Fedora and SUSE.  Here, I noted down some useful commands to manage RPM packages.  Please share if you know other useful RPM commands.</p>
<p>&nbsp;<br />
<br />&nbsp;<br />
<strong>Install a package:</strong></p>
<pre>rpm -ivh package_name</pre>
<p>&nbsp;<br />
<strong>Upgrade a package:</strong></p>
<pre>rpm -Uvh package_name</pre>
<p>&nbsp;<br />
<strong>Uninstall a package:</strong></p>
<pre>rpm -ev package_name</pre>
<p>&nbsp;<br />
<strong>Uninstall a package without checking for its dependencies:</strong></p>
<pre>rpm -ev --nodeps package_name</pre>
<p>&nbsp;<br />
<strong>Display the version of the installed package:</strong></p>
<pre>rpm -q package_name</pre>
<p>&nbsp;<br />
<strong>Display the name and version of all packages installed in the server:</strong></p>
<pre>rpm -qa</pre>
<p>&nbsp;<br />
<strong>Display the packages got installed recently:</strong></p>
<pre>rpm -qa --last</pre>
<p>&nbsp;<br />
<strong>To rebuild a corrupted RMP database:</strong></p>
<pre>rpm --rebuilddb</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/rpm-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen cheat sheet</title>
		<link>http://www.unixnewbie.org/screen-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/screen-cheat-sheet/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 16:45:04 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=913</guid>
		<description><![CDATA[Have you ever experienced a problem where your remote shell session got killed (for various reasons) in the middle of your crucial software compilations?  Well it has happened to me several times ranging from getting killed in the middle of php compilations, easyapache, kernel :oops:, to a new cPanel installation 8O.  Most of the time, it was due to bad internet connection.  To combat with this, a friend suggested me a solution: to use Screen.]]></description>
			<content:encoded><![CDATA[<p>Have you ever experienced a problem where your remote shell session got killed (for various reasons) in the middle of your crucial software compilations?  Well it has happened to me several times ranging from getting killed in the middle of php compilations, easyapache, kernel <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' /> , to a new cPanel installation 8O.  Most of the time, it was due to bad internet connection.  To combat with this, a friend suggested me a solution: to use Screen.</p>
<p>&nbsp;<br />
<strong>What is Screen?</strong><br />
Screen is a free Unix software.  Under Screen, if your shell session gets disconnected, the screen session doesn&#8217;t go away.  It will continue the compilations until completion.  Sounds good <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' /> </p>
<p>&nbsp;<br />
<strong>How to install screen under CentOS?</strong></p>
<pre>yum install screen</pre>
<p>&nbsp;<br />
<strong>How to use Screen?</strong> Simply type:</p>
<pre>screen</pre>
<p>then you will be led into a new virtual shell terminal.  After that, just work with your commands normally.</p>
<p>&nbsp;<br />
<strong>If my session got disconnected, how do I resume my Screen session?</strong></p>
<pre>screen -r</pre>
<p>&nbsp;<br />
<strong>If I have multiple screen sessions, how do I see them?</strong></p>
<pre>screen -list</pre>
<p>&nbsp;<br />
<strong>How to exit Screen?</strong></p>
<pre>exit</pre>
<p>&nbsp;<br />
<strong>How do I exit Screen but still leaving my compilations to keep on compiling?</strong></p>
<pre>ctrl+a+d</pre>
<p>You will then led back to your original shell session.  Your screen session will keep on working.  To resume, you can use &#8220;screen -r&#8221;.  Pretty useful right?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/screen-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some useful sysadmin commands</title>
		<link>http://www.unixnewbie.org/some-useful-sysadmin-commands/</link>
		<comments>http://www.unixnewbie.org/some-useful-sysadmin-commands/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 15:30:11 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://unixnewbie.org/blog/?p=58</guid>
		<description><![CDATA[This post lists some useful server administration commands.]]></description>
			<content:encoded><![CDATA[<p><strong>Some useful sysadmin commands:</strong></p>
<ol>
<li>Show the disk usage per directory one level:
<pre>
FreeBSD: du -h -d 1
Linux: du -h --max-depth=1</pre>
</li>
<li>How to create a Symlink/Softlink?
<pre>ln -s realpath fakepath</pre>
</li>
<li>Emptying a file without deleting it:(i.e. quick way to empty system logs)
<pre>cp /dev/null filename</pre>
</li>
<li>This command will show exim processes including the path to the script being utilized to send mail. Very useful in locating a spamming script.
<pre>ps -C exim -fH eww</pre>
</li>
<li>To trace through the hops the email gets delivered. This is useful to determine if the message can reach its destination or not.
<pre>exim -bt username@domain.com</pre>
</li>
<li>Watching logs:
<pre>tail -f /path/to/log-file</pre>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/some-useful-sysadmin-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
