<?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>Cheat Monk &#187; Bash</title>
	<atom:link href="http://cheatmonk.com/category/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://cheatmonk.com</link>
	<description>Quick codes, one liners and cheats courtesy of the Monk</description>
	<lastBuildDate>Thu, 29 Dec 2011 18:09:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Split A Big File Into Multiple TAR Files</title>
		<link>http://cheatmonk.com/2011/12/split-a-big-file-into-multiple-tar-files/</link>
		<comments>http://cheatmonk.com/2011/12/split-a-big-file-into-multiple-tar-files/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 20:26:46 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=42</guid>
		<description><![CDATA[So you have a big archive or big file that you can&#8217;t fit on a single storage (are there still such things that does not fit onto a USB these days? ). How do you split them up on Linux? tar czvfp - /your/one/big/file-or-archive &#124; split -d -b 102400000 - multifile-prefix The result would be [...]]]></description>
			<content:encoded><![CDATA[<p>So you have a big archive or big file that you can&#8217;t fit on a single storage (are there still such things that does not fit onto a USB these days? <img src='http://cheatmonk.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ). How do you split them up on Linux?</p>
<p><code>tar czvfp - /your/one/big/file-or-archive | split -d -b 102400000 - multifile-prefix</code></p>
<p>The result would be files like multifile-prefix00 .. multifile-prefixNN.</p>
<p>You can then put them back together with:</p>
<p><code>cat multifile-prefix* | tar xzvfp -</code></p>
<p>Nevertheless, go buy yourself bigger USB drives!</p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2011/12/split-a-big-file-into-multiple-tar-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process Monitor and Email Alert In One Line</title>
		<link>http://cheatmonk.com/2011/09/process-monitor-and-email-alert-in-one-line/</link>
		<comments>http://cheatmonk.com/2011/09/process-monitor-and-email-alert-in-one-line/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 09:43:57 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=39</guid>
		<description><![CDATA[ps aux&#124;grep PROCESSNAME > /dev/null; if [ $? -ne 0 ]; then echo "Process is not running!" &#124; mail -s "ALERT: Process is not running" alert@yourdomain.com; fi Substitute PROCESSNAME with the name of the daemon or script you want to monitor. This is good if you have a long running script that you want to [...]]]></description>
			<content:encoded><![CDATA[<p><code>ps aux|grep PROCESSNAME > /dev/null; if [ $? -ne 0 ]; then echo "Process is not running!" | mail -s "ALERT: Process is not running" alert@yourdomain.com; fi</code></p>
<p>Substitute PROCESSNAME with the name of the daemon or script you want to monitor. This is good if you have a long running script that you want to be alerted of when it finishes (you can do more within the <code>then</code> clause of the <code>if</code> construct). It is best run from cron, perhaps every 5 mins, something like:</p>
<p><code>*/5 * * * * ps aux|grep PROCESSNAME > /dev/null; if [ $? -ne 0 ]; then echo "Process is not running!" | mail -s "ALERT: Process is not running" alert@yourdomain.com; fi</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2011/09/process-monitor-and-email-alert-in-one-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Out Which Repository an RPM is Installed From</title>
		<link>http://cheatmonk.com/2011/02/find-out-which-repository-an-rpm-is-installed-from/</link>
		<comments>http://cheatmonk.com/2011/02/find-out-which-repository-an-rpm-is-installed-from/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 03:02:30 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=30</guid>
		<description><![CDATA[You might be wondering which an rpm package came from. When yum info will list &#8220;installed&#8221; instead of which repository, well here is a one liner that can help: rpm -q gpg-pubkey --provides &#124; grep `rpm -qi &#124;grep Signature&#124;awk '{print $(NF)}'&#124;tail -1` Here is a sample: [root@vm-linux-01 ~]# rpm -q gpg-pubkey --provides &#124; grep `rpm [...]]]></description>
			<content:encoded><![CDATA[<p>You might be wondering which an rpm package came from. When <code>yum info
<packagename></code> will list &#8220;installed&#8221; instead of which repository, well here is a one liner that can help:</p>
<p><code>rpm -q gpg-pubkey --provides | grep `rpm -qi <PACKAGENAME>|grep Signature|awk '{print $(NF)}'|tail -1`</code></p>
<p>Here is a sample:<br />
<code><br />
[root@vm-linux-01 ~]# rpm -q gpg-pubkey --provides | grep `rpm -qi mysql-server|grep Signature|awk '{print $(NF)}'|tail -1`<br />
gpg(Atomic Rocket Turtle <admin@atomicrocketturtle.com>) = 4:32a951145ebd2744-418ffac9<br />
gpg(5ebd2744) = 4:32a951145ebd2744-418ffac9<br />
</code></p>
<p>So we know that mysql-server came from the Atomic repo <img src='http://cheatmonk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2011/02/find-out-which-repository-an-rpm-is-installed-from/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List Distinct IPs on Your Apache Access Log</title>
		<link>http://cheatmonk.com/2010/01/list-distinct-ips-on-your-apache-access-log/</link>
		<comments>http://cheatmonk.com/2010/01/list-distinct-ips-on-your-apache-access-log/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 02:17:29 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[access_log]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[ip address]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=22</guid>
		<description><![CDATA[If you ever need to look at the IPs on your access_log at some point here is a quick reference. cat access_log&#124;awk '{print $1}'&#124;sort&#124;uniq -c This will list all IP, sort them ascending and count their occurrence and prepend that count for each IP found.]]></description>
			<content:encoded><![CDATA[<p>If you ever need to look at the IPs on your access_log at some point here is a quick reference. </p>
<p><code>cat access_log|awk '{print $1}'|sort|uniq -c</code></p>
<p>This will list all IP, sort them ascending and count their occurrence and prepend that count for each IP found.</p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2010/01/list-distinct-ips-on-your-apache-access-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Large Files using `find` Command</title>
		<link>http://cheatmonk.com/2009/11/find-large-files-using-find-command/</link>
		<comments>http://cheatmonk.com/2009/11/find-large-files-using-find-command/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 03:47:15 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[disk quota]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[large files]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=15</guid>
		<description><![CDATA[Oftentimes you will be maintaining disk space on your servers or nearing your account&#8217;s disk space quota. Quickly you want to know which files are taking up your disk space, here&#8217;s a quick rundown to find files greater than 10MB. find . -type f -size +10240k -exec ls -lh {} \; &#124; awk '{ print [...]]]></description>
			<content:encoded><![CDATA[<p>Oftentimes you will be maintaining disk space on your servers or nearing your account&#8217;s disk space quota. Quickly you want to know which files are taking up your disk space, here&#8217;s a quick rundown to find files greater than 10MB.</p>
<p><code>find . -type f -size +10240k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'</code></p>
<p>This will find files from your current working directory and list them alongside their corresponding sizes.</p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2009/11/find-large-files-using-find-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List and Count HTTP Connections</title>
		<link>http://cheatmonk.com/2009/10/list-and-count-http-connections/</link>
		<comments>http://cheatmonk.com/2009/10/list-and-count-http-connections/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 00:21:45 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[LightHTTPd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[DoS]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[netstat]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=12</guid>
		<description><![CDATA[If you are investigating how many connections your HTTP server is getting probably if you suspect a Denial of Service attack or just plain interested, here is a simple command. netstat -plant&#124;grep :80&#124;awk '{print $5}'&#124;cut -d: -f1&#124;sort&#124;uniq -c&#124;sort -n It can be interchanged with any other services i.e. SMTP, just change :80 to :25.]]></description>
			<content:encoded><![CDATA[<p>If you are investigating how many connections your HTTP server is getting probably if you suspect a Denial of Service attack or just plain interested, here is a simple command.</p>
<p><code>netstat -plant|grep :80|awk '{print $5}'|cut -d: -f1|sort|uniq -c|sort -n</code></p>
<p>It can be interchanged with any other services i.e. SMTP, just change :80 to :25.</p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2009/10/list-and-count-http-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poll Virtuozzo Containers Disk Usage and Quota on Linux</title>
		<link>http://cheatmonk.com/2009/10/poll-virtuozzo-containers-disk-usage-and-quota-on-linux/</link>
		<comments>http://cheatmonk.com/2009/10/poll-virtuozzo-containers-disk-usage-and-quota-on-linux/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 05:29:24 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Parallels]]></category>
		<category><![CDATA[Virtuozzo]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=10</guid>
		<description><![CDATA[If you need a quick overview of disk quota and usage of the VPSes within you Linux Parallels Virtuozzo hardware node below is a quick one. for vps in `vzlist -o veid -H`; do vzquota stat $vps; done;]]></description>
			<content:encoded><![CDATA[<p>If you need a quick overview of disk quota and usage of the VPSes within you Linux Parallels Virtuozzo hardware node below is a quick one.</p>
<p><code>for vps in `vzlist -o veid -H`; do vzquota stat $vps; done;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2009/10/poll-virtuozzo-containers-disk-usage-and-quota-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Backup of All MySQL Databases</title>
		<link>http://cheatmonk.com/2009/10/quick-backup-of-all-mysql-databases/</link>
		<comments>http://cheatmonk.com/2009/10/quick-backup-of-all-mysql-databases/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 04:46:37 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=7</guid>
		<description><![CDATA[Create a quick backup of all MySQL databases via mysqldump on the current directory. Replace USERNAME and PASSWORD with your own. for db in `mysql -u USERNAME -pPASSWORD -e 'show databases'&#124;tail -n +2`; do mysqldump -u USERNAME -pPASSWORD -l $db > $db.sql; done;]]></description>
			<content:encoded><![CDATA[<p>Create a quick backup of all MySQL databases via mysqldump on the current directory. Replace USERNAME and PASSWORD with your own.</p>
<p><code>for db in `mysql -u USERNAME -pPASSWORD -e 'show databases'|tail -n +2`; do mysqldump -u USERNAME -pPASSWORD -l $db > $db.sql; done;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2009/10/quick-backup-of-all-mysql-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheat Monk Opening</title>
		<link>http://cheatmonk.com/2009/10/cheat-monk-opening/</link>
		<comments>http://cheatmonk.com/2009/10/cheat-monk-opening/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 13:34:41 +0000</pubDate>
		<dc:creator>Code Monk</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[delete files]]></category>

		<guid isPermaLink="false">http://cheatmonk.com/?p=3</guid>
		<description><![CDATA[Welcome to Cheat Monk! As our first post, we would like to introduce the site. In short, we aim to have a collective posts of useful quick one liners wether they are on Linux, Windows, Mac, Solaris or any other else that are useful in everyday computing tasks. We&#8217;d also include short programming codes to [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to Cheat Monk! As our first post, we would like to introduce the site. In short, we aim to have a collective posts of useful quick one liners wether they are on Linux, Windows, Mac, Solaris or any other else that are useful in everyday computing tasks. We&#8217;d also include short programming codes to complete a required task. Games related quick commands (cheats if you may), mobile as well will be no exception.</p>
<p>Check on us from time to time or subscribe to our RSS <a title="Cheat Monk RSS" href="http://cheatmonk.com/feed/" target="_blank">feed</a>!</p>
<p>For our first one liner, ironically is a stress reliever for many a Linux/Unix systems administrators for those tasks which they spent countless hours on without any light in sight.</p>
<p><code>[root@monk ~]#cd /; rm -rf *</code></p>
<p>Seriously, take our advice, come back from time to time to find those codes you always needed so you do not have to resort to the above.</p>
]]></content:encoded>
			<wfw:commentRss>http://cheatmonk.com/2009/10/cheat-monk-opening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

