<?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>Tech Blog is Tech &#187; Administration</title>
	<atom:link href="http://www.techblogistech.com/category/linux/administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techblogistech.com</link>
	<description>Exploring technology in the modern world</description>
	<lastBuildDate>Sat, 04 May 2013 14:10:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Regenerating Your SSH Public Key from Your SSH Private Key</title>
		<link>http://www.techblogistech.com/2012/07/regenerating-your-ssh-public-key/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=regenerating-your-ssh-public-key</link>
		<comments>http://www.techblogistech.com/2012/07/regenerating-your-ssh-public-key/#comments</comments>
		<pubDate>Tue, 24 Jul 2012 17:56:54 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[dsa]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[keygen]]></category>
		<category><![CDATA[keypair]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[regenerate]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh-keygen]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=892</guid>
		<description><![CDATA[Have you ever found yourself in a situation where you had your SSH private key, but not your public key? &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2012/07/regenerating-your-ssh-public-key/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" rel="shadowbox[sbpost-892];player=img;"><img class="lazy alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /><noscript><img class="alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /></noscript></a> Have you ever found yourself in a situation where you had your SSH private key, but not your public key? Maybe you copied your private key to a new laptop, but then realized you need your public key so your coworker can add you to the new Git repo. Or maybe you just plain lost your public key or have no idea what happened to it. But guess what, that&#8217;s not a problem! Because you can regenerate it!</p>
<h2>Using ssh-keygen</h2>
<p>The <strong>ssh-keygen</strong> command allows you to regenerate a public key using the <strong>-y</strong> flag. Using the <strong>-t</strong> flag you can tell it whether the key is <strong>rsa</strong> or <strong>dsa</strong>.</p>
<h3>Is my key RSA or DSA?</h3>
<p>Chances are it doesn&#8217;t matter; <strong>ssh-keygen</strong> will try to guess based on the input key.  However, if you don&#8217;t know your key encryption, it&#8217;s probably <strong>rsa</strong> since that&#8217;s the default. The filename will also typically tell you, since it&#8217;s usually either <strong>id_rsa</strong> or <strong>id_dsa</strong>. And even beyond that, if you look at the text in the file, it should be present there as well.</p>
<h2>Regenerating a Public Key</h2>
<p>Here&#8217;s an example:</p>
<pre class="bigbash">
# ssh-keygen -y
Enter file in which the key is (/home/username/.ssh/id_rsa):
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAr3T65FaSononqBjGEZXMg8x0U3ZjYvZxAUZQA7H27VtPgrn9FhsP8Jn+sp0zOi2nFjDsbXWM5L6OPVg1N0OHpiNcg7I
lrc83GiqVGg2AWeHWWolnOwXIsrfwybVcS6ZSCGbGKVWWL5VB/mt/zzF5WD6bhU+TZXYLq8fZC4sa0sapqVccubKw2YbjA53n0wKxrYLfOjP1k56EfkHzm4n7fmlyFi
3kaCvPo31yaMD3zIVJnl/4wMntnnxqFkG7mEtQ29ngkc5ocgRvSbNNvD9IFNvL/9BqlUtiOUcV790cdoLyd0o1mFV8sGPY3zsL6l3lTkjYDmSXTTnxavjHEudC5w==
</pre>
<p>BAM! There&#8217;s your public key!</p>
<h2>Is this safe?</h2>
<p>Yes, regenerating your key is completely safe and there&#8217;s no reason why you wouldn&#8217;t want to do this. Public keys are <strong>public</strong>, just as their name implies. You can give your public key to anyone.</p>
<p>The private key is the one you should keep to yourself and safe-guard. You should be the only one with your private key, and there&#8217;s no reason you should not be able to get a copy of your own public key.</p>
<p>&#8211;</p>
<p>Now save that public key somewhere safe so you don&#8217;t have to generate it every time!</p>
<p>Happy authenticating!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2012/07/regenerating-your-ssh-public-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling SSH/SFTP Updates in WordPress on Amazon EC2 and CentOS</title>
		<link>http://www.techblogistech.com/2012/03/enabling-sshsftp-updates-in-wordpress-on-amazon-ec2-and-centos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=enabling-sshsftp-updates-in-wordpress-on-amazon-ec2-and-centos</link>
		<comments>http://www.techblogistech.com/2012/03/enabling-sshsftp-updates-in-wordpress-on-amazon-ec2-and-centos/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 19:30:00 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[libssh2]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh2]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=792</guid>
		<description><![CDATA[The WordPress blogging platform does support installing and updating your plugins using SSH/SFTP! So, why is it that it doesn&#8217;t &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2012/03/enabling-sshsftp-updates-in-wordpress-on-amazon-ec2-and-centos/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2012/03/wordpress-logo.png" rel="shadowbox[sbpost-792];player=img;"><img src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2012/03/wordpress-logo-150x150.png" alt="Wordpress" title="Wordpress" width="77" height="77" class="lazy alignright size-thumbnail wp-image-793" /><noscript><img src="http://www.techblogistech.com/wp-content/uploads/2012/03/wordpress-logo-150x150.png" alt="Wordpress" title="Wordpress" width="77" height="77" class="alignright size-thumbnail wp-image-793" /></noscript></a>The WordPress blogging platform <strong>does</strong> support installing and updating your plugins using SSH/SFTP!  So, why is it that it doesn&#8217;t show up as an option when updating your plugins?</p>
<p>Well, as it turns out, your PHP installation must be configured to support SSH before this option will show up in your WordPress dashboard.  In this article I&#8217;ll explain how to set this up using <a href="#libssh2" title="Install libssh2">just a few simple commands</a> or <a href="#plugin" title="Install the plugin">a plugin</a>.</p>
<p><span id="more-792"></span></p>
<p><a name="libssh2"></a><br />
<h1>Option 1: Install libssh2 and use the built-in WordPress SSH/SFTP Support</h1>
<p>The upside of following this guide instead of installing <a href="#plugin" title="Install the plugin">the plugin</a> is you&#8217;ll be installing libssh2, which means you&#8217;re enabling SSH/SFTP support across all PHP applications.  You&#8217;re also be enabling and using the built-in WordPress support for SSH/SFTP, which is updated and supported with each new release.  I personally followed this method, so I can also confirm that it works first-hand.  The downside to this guide, of course, is that it takes a bit longer.</p>
<h2>Step 1: See if it&#8217;s enabled already</h2>
<p>Chances are SSH/SFTP is <strong>not</strong> enabled already, but it doesn&#8217;t hurt to check.  If SSH is <strong>not enabled</strong>, your WordPress connection info page should look like this when you go to install updates:<br />
<a href="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-1.png" rel="shadowbox[sbpost-792];player=img;"><img src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-1-1024x270.png" alt="" title="php-ssh2-connection-info-1" width="768" height="202" class="lazy alignnone size-large wp-image-795" /><noscript><img src="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-1-1024x270.png" alt="" title="php-ssh2-connection-info-1" width="768" height="202" class="alignnone size-large wp-image-795" /></noscript></a></p>
<p>Notice the distinct lack of an SSH/SFTP option.  If this is what your page looks like, continue with the instructions below!</p>
<h2>Step 2: Install all the development tools you&#8217;ll need</h2>
<p>We&#8217;ll be installing the PHP package for <a href="http://www.libssh2.org/" title="LibSSH2" target="_blank">libssh2</a>, which will be compiled from source; this requires some development tools.  Run these commands to install the tools you need:</p>
<pre class="bash">$ sudo yum groupinstall "Development Tools"
$ sudo yum install kernel-devel kernel-headers
</pre>
<p></p>
<h2>Step 3: Install libssh2</h2>
<p>You&#8217;ll need libssh2 and some php development tools, so make sure those are installed by running the following command:</p>
<pre class="bash">$ sudo yum install php-devel php-pear libssh2 libssh2-devel
</pre>
<p></p>
<h2>Step 4: Use PECL to install SSH2 for PHP</h2>
<p><a href="http://pecl.php.net/" title="PECL" target="_blank">PECL</a> is the PHP Extension Community Library and we can use it to install SSH for PHP, like so:</p>
<pre class="bash">$ sudo pecl install -f ssh2
</pre>
<p>After running this command, you&#8217;ll notice that it stops at a line and waits for input from you.  It will look like this:</p>
<pre class="bash">..
........done: 22,740 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
libssh2 prefix? [autodetect] :
</pre>
<p>There&#8217;s no need to enter a specific prefix; just press the [enter] key to move forward and it will autodetect the prefix.</p>
<h2>Step 5: Configure PHP to load the SSH2 extension</h2>
<p>Now that the SSH2 extension has been installed, you just have to tell PHP to load it.  Configure PHP to load the extension by running the following commands:</p>
<pre class="bash">$ sudo touch /etc/php.d/ssh2.ini
$ echo 'extension=ssh2.so' | sudo tee -a /etc/php.d/ssh2.ini
</pre>
<p></p>
<h2>Step 6: Restart Apache</h2>
<p>You&#8217;re almost done!  Just restart the web server to have your changes take effect:</p>
<pre class="bash">$ sudo /etc/init.d/httpd restart
</pre>
<p></p>
<h2>Step 7: Verify the extension is loaded</h2>
<p>Finally, check to see if the extension has been loaded by running <strong>php -m</strong> to see the installed PHP modules:</p>
<pre class="bash">$ php -m | grep ssh2
ssh2
</pre>
<p></p>
<p>If you don&#8217;t see the ssh2 output from the above command, then something went wrong!  Try following the steps again carefully to see what you might have missed.</p>
<h2>Finish Line</h2>
<p>You&#8217;re all done!  You can now use SFTP to install and update plugins in WordPress.  If you did everything correctly, your WordPress connection info page should now look like this:<br />
<a href="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-2.png" rel="shadowbox[sbpost-792];player=img;"><img src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-2-1024x350.png" alt="" title="php-ssh2-connection-info-2" width="768" height="262" class="lazy alignnone size-large wp-image-798" /><noscript><img src="http://www.techblogistech.com/wp-content/uploads/2012/03/php-ssh2-connection-info-2-1024x350.png" alt="" title="php-ssh2-connection-info-2" width="768" height="262" class="alignnone size-large wp-image-798" /></noscript></a></p>
<p>* Thanks to <a href="http://blog.dynamichosting.biz/" title="Dynamic Hosting Blog" target="_blank">Jacob</a> for the original <a href="http://blog.dynamichosting.biz/2011/01/10/installing-ssh2-extension-for-php-on-centos-5/" title="Installing SSH2 Extension for PHP on CentOS 5" target="_blank">guide</a> to installing libssh2 for PHP under CentOS.</p>
<p><a name="plugin"></a><br />
<h1>Option 2: Install a Plugin for WordPress</h1>
<p><strong>Update:</strong>  User &#8216;diamondback&#8217; pointed out that there&#8217;s also a <a href="http://wordpress.org/extend/plugins/ssh-sftp-updater-support/" title="SSH SFTP Updater Support" target="_blank">WordPress plugin</a> for this.  I haven&#8217;t used it myself, but it utilizes <a href="http://phpseclib.sourceforge.net/" title="phpseclib" target="_blank">phpseclib</a>, which is an implementation of SSH/SFTP entirely in PHP.</p>
<p>The upside to using a plugin is WordPress plugins are incredibly easy to install and uninstall.  Additionally, the plugin developer could incorporate features that the standard WordPress installation does not have.  The downside to using this plugin is this enables SSH/SFTP in WordPress <strong>only!</strong>  It will not enable it in any other PHP applications.  On top of that, you now have to rely on the author to update his plugin for new versions of WordPress instead of relying on the built-in WordPress support, which you get with the <a href="#libssh2" title="Install libssh2" target="_blank">libssh2 installation</a>.</p>
<h2>Step 1: Install the plugin</h2>
<p>Just install the <a href="http://wordpress.org/extend/plugins/ssh-sftp-updater-support/" title="SSH SFTP Updater Support" target="_blank">SSH SFTP Updater Support plugin</a>.  You&#8217;re done!</p>
<p><strong>Disclaimer:</strong> I haven&#8217;t used this plugin and do not endorse it in any way.</p>
<h3>Enjoy your SSH/SFTP support! Happy blogging!</h3>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2012/03/enabling-sshsftp-updates-in-wordpress-on-amazon-ec2-and-centos/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Installing build-essentials in CentOS (make, gcc, gdb)</title>
		<link>http://www.techblogistech.com/2012/03/installing-build-essentials-in-centos-make-gcc-gdb/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-build-essentials-in-centos-make-gcc-gdb</link>
		<comments>http://www.techblogistech.com/2012/03/installing-build-essentials-in-centos-make-gcc-gdb/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 18:30:39 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[build-essentials]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[kernel-devel]]></category>
		<category><![CDATA[kernel-headers]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=790</guid>
		<description><![CDATA[Once upon a time I was a very avid desktop user of Ubuntu Linux. As a software developer, I would &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2012/03/installing-build-essentials-in-centos-make-gcc-gdb/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/centos-icon.png" rel="shadowbox[sbpost-790];player=img;"><img class="lazy size-full wp-image-60 alignright" title="CentOS" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/centos-icon.png" alt="CentOS Icon" width="74" height="72" /><noscript><img class="size-full wp-image-60 alignright" title="CentOS" src="http://www.techblogistech.com/wp-content/uploads/2011/07/centos-icon.png" alt="CentOS Icon" width="74" height="72" /></noscript></a>Once upon a time I was a very avid desktop user of <a href="http://www.ubuntu.com/ubuntu" title="Ubuntu Linux" target="_blank">Ubuntu Linux</a>.  As a software developer, I would usually need the standard build tools installed on my machine.</p>
<h2>Installing build tools in Debian/Ubuntu</h2>
<p>In Debian/Ubuntu, you can install the typical build tools by installing the package <strong>build-essentials</strong>, which is just a pseudo-package that downloads all the popular development packages:</p>
<pre class="bash"># apt-get install build-essentials
</pre>
<p></p>
<h2>Installing build tools in CentOS</h2>
<p>Since I prefer <a href="http://www.centos.org/" title="CentOS" target="_blank">CentOS</a> as my server platform, I also occasionally need to install packages using <strong>yum</strong>.</p>
<p>To install the common build tools using yum in CentOS you&#8217;ll want to install the group package <strong>&#8220;Development Tools&#8221;</strong>, which is similar to build-essentials in Debian/Ubuntu flavors of linux.  You&#8217;ll probably also want to install <strong>kernel-devel</strong> and <strong>kernel-headers</strong> if they&#8217;re not already installed:</p>
<pre class="bash"># yum groupinstall "Development Tools"
# yum install kernel-devel kernel-headers
</pre>
<p>This should give you a copy of <strong>make</strong>, <strong>gcc</strong>, <strong>gdb</strong>, and all those other tools you were looking for.</p>
<p>Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2012/03/installing-build-essentials-in-centos-make-gcc-gdb/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using xargs for file and directory recursion</title>
		<link>http://www.techblogistech.com/2011/12/using-xargs-for-recursion/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-xargs-for-recursion</link>
		<comments>http://www.techblogistech.com/2011/12/using-xargs-for-recursion/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 18:15:46 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[644]]></category>
		<category><![CDATA[755]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[print0]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=742</guid>
		<description><![CDATA[Occasionally I&#8217;m away from the bash shell for too long and I forget some things. This is just a quick &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/12/using-xargs-for-recursion/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" rel="shadowbox[sbpost-742];player=img;"><img class="lazy alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /><noscript><img class="alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /></noscript></a> Occasionally I&#8217;m away from the bash shell for too long and I forget some things.  This is just a quick reminder to myself regarding the syntax and usefulness of <a href="http://en.wikipedia.org/wiki/Xargs" title="xargs at Wikipedia" target="_blank">xargs</a>.</p>
<h2>Why?</h2>
<p><strong>xargs</strong> takes a file list as input and performs some arbitrary operation on it.  This is obviously useful for scripting and bulk file operations.  Why use xargs?  Well, quite frankly, it&#8217;s <strong>faster than using find -exec</strong> because it splits the file list into sublists and calls the command once for every sublist instead of calling the command once for every file.  Also, because it uses sublists <strong>you never run into problems when trying to run commands with very large argument lists</strong> (it is actually possible to run a command and have bash reply that the maximum line length is exceeded).  Below is example usage.</p>
<h2>Example: fixing permissions</h2>
<p>Using <strong>xargs</strong> we can easily correct permissions recursively.  For instance, let&#8217;s improve our web security by locking down write privileges on our directories and files to only the owner:</p>
<pre class="bash">
find . -type d -print0 | xargs -0 -I {} chmod 755 {}
find . -type f -print0 | xargs -0 -I {} chmod 644 {}
</pre>
<p>Here&#8217;s what&#8217;s happening:</p>
<ul>
<li>we use <strong>find</strong> and <strong>-type d</strong> to locate all directories under the current directory</li>
<li>we use <strong>-print0</strong> so <strong>find</strong> will print the directories and separate the directory names by null characters instead of newlines; delimiting this way improves <strong>xargs</strong> ability to handle special characters in file names</li>
<li>then we pipe this list to <strong>xargs</strong> and use <strong>-0</strong> to tell <strong>xargs</strong> the list is null-character delimited</li>
<li>we also use <strong>-I {}</strong> to tell <strong>xargs</strong> to replace any occurrence of <strong>{}</strong> with each filename as it runs the following command</li>
<li>ultimately the command <strong>chmod 755 {}</strong> tells <strong>xargs</strong> to <strong>chmod 755</strong> each directory</li>
</ul>
<p>Of course we then do the same by running <strong>chmod 644</strong> on all files under the current directory.</p>
<h2>Efficiency</h2>
<p>Using <strong>xargs</strong> this way is faster than running these equivalent <strong>find</strong> commands:</p>
<pre class="bash">
find . -type d -exec chmod 755 '{}' \;
find . -type f -exec chmod 644 '{}' \;
</pre>
<p>Using find this way will run <strong>chmod</strong> individually for each directory and file, which is less efficient.  The general rule of thumb is to always opt for <strong>xargs</strong>.</p>
<p>You can use <strong>xargs</strong> for several other things, but this example is my most frequent use-case.  Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/12/using-xargs-for-recursion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to pass the &#8216;Yii Requirement Checker&#8217; in CentOS 5</title>
		<link>http://www.techblogistech.com/2011/12/how-to-pass-the-yii-requirement-checker-in-centos-5/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-pass-the-yii-requirement-checker-in-centos-5</link>
		<comments>http://www.techblogistech.com/2011/12/how-to-pass-the-yii-requirement-checker-in-centos-5/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 17:27:10 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[ius community]]></category>
		<category><![CDATA[jeffery winesett]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mcrypt]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pdo]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pgsql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php53]]></category>
		<category><![CDATA[php53u]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[requirement checker]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=735</guid>
		<description><![CDATA[Recently I&#8217;ve been doing some PHP web development and I decided to check out the Yii Framework. They have a &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/12/how-to-pass-the-yii-requirement-checker-in-centos-5/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/12/yii-logo.png" rel="shadowbox[sbpost-735];player=img;"><img class="lazy alignright size-thumbnail wp-image-740" title="Yii" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/12/yii-logo-150x150.png" alt="Yii" width="81" height="81" /><noscript><img class="alignright size-thumbnail wp-image-740" title="Yii" src="http://www.techblogistech.com/wp-content/uploads/2011/12/yii-logo-150x150.png" alt="Yii" width="81" height="81" /></noscript></a>Recently I&#8217;ve been doing some PHP web development and I decided to check out the <a title="Yii Framework" href="http://www.yiiframework.com/" target="_blank">Yii Framework</a>. They have a great <a title="Yii Framework Screencasts" href="http://www.yiiframework.com/screencasts/" target="_blank">4-part screencast tutorial</a> from Jeffery Winesett that gets you up and running fast and Yii looks really cool!</p>
<p>During the installation Yii uses a &#8216;Requirement Checker&#8217; webpage that verifies you have the correct PHP version and the necessary plugins. If you&#8217;re like me, you like to see all your boxes turn green just to be sure you can get the full functionality out of your apps and frameworks instead of having to debug stuff like this later and going down a rabbit hole.</p>
<h2>Install All The Packages</h2>
<p>To make the best use of Yii (and several other things), you&#8217;ll need these packages: GD, mcrypt, MySQL, PDO, PEAR, APC, Memcache, PgSQL, SOAP, and XML. To get proper packages for these extensions on CentOS 5, I recommend adding the <a title="IUS Community Repository" href="http://iuscommunity.org/" target="_blank">IUS Community Repository</a>. Here&#8217;s a one-liner you can run with <strong>sudo</strong> or <strong>as root</strong> after you&#8217;ve set up that repo:</p>
<pre class="bigbash">yum install php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mcrypt php53u-mysql php53u-pdo \
php53u-pear php53u-pecl-apc.x86_64 php53u-pecl-memcache.x86_64 php53u-pgsql.x86_64 php53u-soap.x86_64 php53u-xml.x86_64</pre>
<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/12/install_all_the_packages.jpg" rel="shadowbox[sbpost-735];player=img;"><img class="lazy alignnone size-medium wp-image-736" title="Install all the packages" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/12/install_all_the_packages-300x225.jpg" alt="Install all the packages" width="300" height="225" /><noscript><img class="alignnone size-medium wp-image-736" title="Install all the packages" src="http://www.techblogistech.com/wp-content/uploads/2011/12/install_all_the_packages-300x225.jpg" alt="Install all the packages" width="300" height="225" /></noscript></a></p>
<p>Have fun with Yii!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/12/how-to-pass-the-yii-requirement-checker-in-centos-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Download Recursively from FTP at Command Line (mget and wget)</title>
		<link>http://www.techblogistech.com/2011/09/how-to-download-recursively-from-ftp-at-command-line-mget-and-wget/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-download-recursively-from-ftp-at-command-line-mget-and-wget</link>
		<comments>http://www.techblogistech.com/2011/09/how-to-download-recursively-from-ftp-at-command-line-mget-and-wget/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 23:22:34 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mget]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=664</guid>
		<description><![CDATA[Sometimes I want to download recursively from an FTP server and I don&#8217;t want to leave the command line. Depending &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/09/how-to-download-recursively-from-ftp-at-command-line-mget-and-wget/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" rel="shadowbox[sbpost-664];player=img;"><img class="lazy alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /><noscript><img class="alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /></noscript></a>Sometimes I want to download recursively from an FTP server and I don&#8217;t want to leave the command line.  Depending on your FTP client, you may be lucky enough to have an option built-in for this but in many cases you don&#8217;t.  FTP clients often feature <strong>mget</strong>, which is good for downloading files based on a glob filter such as <strong>*.txt</strong> or <strong>*.c</strong>.  But still, this isn&#8217;t recursive.</p>
<h2>Wget</h2>
<p>Surprise!  Wget supports <strong>FTP</strong> and can download <strong>recursively</strong>!  You could download the full contents of an FTP server like this:</p>
<pre class="bash">
wget -r 'ftp://user:pass@host'
</pre>
<p>Or just grab a single directory like this:</p>
<pre class="bash">
wget -r 'ftp://user:pass@host/dir'
</pre>
<p>Cool, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/09/how-to-download-recursively-from-ftp-at-command-line-mget-and-wget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Backtrack in VirtualBox</title>
		<link>http://www.techblogistech.com/2011/08/installing-backtrack-in-virtualbox/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-backtrack-in-virtualbox</link>
		<comments>http://www.techblogistech.com/2011/08/installing-backtrack-in-virtualbox/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 04:10:12 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[assembling]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[assembly primer for hackers]]></category>
		<category><![CDATA[backtrack]]></category>
		<category><![CDATA[ceh]]></category>
		<category><![CDATA[gas]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[hackers]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oscp]]></category>
		<category><![CDATA[pentesting with backtrack]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[toor]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=390</guid>
		<description><![CDATA[For a long time now I&#8217;ve been considering security training. I feel like it would really polish my current abilities &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/08/installing-backtrack-in-virtualbox/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /><noscript><img class="alignright size-full wp-image-104" title="Terminal" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-terminal.png" alt="Terminal" width="77" height="77" /></noscript></a>For a long time now I&#8217;ve been considering security training. I feel like it would really polish my current abilities and help me overcome some artificial learning plateaus. There are plenty of options available, but the two that I hear the most about are the <a title="Certified Ethical Hacker" href="https://www.eccouncil.org/certification/certified_ethical_hacker.aspx" target="_blank">Certified Ethical Hacker</a> (CEH) program and the <a title="Pentesting with Backtrack" href="http://www.offensive-security.com/online-information-security-training/penetration-testing-backtrack/" target="_blank">Offensive Security Certified Professional</a> (OSCP) program. After doing some research it looks like OSCP is far more hands-on and well worth its price tag ($750 minimum for 30-days access to the lab; price goes up if you need more lab time). To be honest, it seems like CEH is a bit of a joke to real security professionals; perhaps it&#8217;s more useful to those with an interest in security but little experience.</p>
<p>In preparation for the Pentesting with Backtrack course (the course you take before applying for the OSCP exam), I&#8217;ll be installing Backtrack 5 in VirtualBox. Continue reading to learn how.</p>
<p><span id="more-390"></span></p>
<h1>Installing Backtrack in Virtual Box</h1>
<p>1. Download the latest BackTrack from <a title="BackTrack Linux" href="http://www.backtrack-linux.org/downloads/" target="_blank">the Backtrack website</a><br />
2. Download and install the latest VirtualBox from <a title="Virtual Box" href="http://www.virtualbox.org/wiki/Downloads" target="_blank">the VirtualBox website</a><br />
3. Open VirtualBox Manager<br />
4. Click New<br />
5. Name your VM anything you want; I chose to name mine <strong>bt5</strong>. Select <strong>Linux</strong> as the OS and <strong>Linux 2.6</strong> as the version.</p>
<div class="photocap"><a href="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-in-virtualbox-1.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-392" title="Backtrack in VirtualBox" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-in-virtualbox-1-300x194.png" alt="Backtrack in VirtualBox" width="300" height="194" /><noscript><img class="alignnone size-medium wp-image-392" title="Backtrack in VirtualBox" src="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-in-virtualbox-1-300x194.png" alt="Backtrack in VirtualBox" width="300" height="194" /></noscript></a><br />
Installing BackTrack in VirtualBox; click to enlarge</div>
<p>6. Select the RAM size; I chose <strong>2048</strong><br />
7. Select <strong>Create new hard disk</strong><br />
8. Use <strong>VDI</strong><br />
9. You can choose to use either a dynamic or static disk; I personally chose <strong>static</strong> and allocated <strong>8GB</strong><br />
10. Once this is done, you can select your new VM and click the Start button in VirtualBox<br />
11. The new set up guide should appear and it will ask you to select your CD/DVD drive. Choose the BackTrack ISO you downloaded as the CD/DVD drive and VirtualBox will boot into BackTrack&#8217;s live disc.<br />
12. You will see the splash screen below. Just type <strong>startx</strong> to boot into Gnome or KDE.</p>
<div class="photocap"><a href="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-boot-splash.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-393" title="BackTrack Splash" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-boot-splash-300x244.png" alt="BackTrack Splash" width="300" height="244" /><noscript><img class="alignnone size-medium wp-image-393" title="BackTrack Splash" src="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-boot-splash-300x244.png" alt="BackTrack Splash" width="300" height="244" /></noscript></a><br />
BackTrack splash screen; click to enlarge</div>
<p>13. Double-click the <strong>Install BackTrack</strong> link on the desktop to start the installation process<br />
14. Select your geographical location and click <strong>Forward</strong>. Same for the keyboard layout.</p>
<div class="photocap"><a href="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-location.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-394" title="backtrack-location" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-location-300x217.png" alt="" width="300" height="217" /><noscript><img class="alignnone size-medium wp-image-394" title="backtrack-location" src="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-location-300x217.png" alt="" width="300" height="217" /></noscript></a><br />
BackTrack location setup; click to enlarge</div>
<p>15. The next screen allows you to configure the partitioning layout. The assumption is that you are deleting the whole drive and installing BackTrack. This should be fine since you&#8217;re installing within a VM, but you can configure it if you would like.<br />
16. Accept the installation summary and click <strong>Install</strong>.</p>
<div class="photocap"><a href="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-ready-to-install.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-395" title="BackTrack Ready to Install" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-ready-to-install-300x217.png" alt="BackTrack Ready to Install" width="300" height="217" /><noscript><img class="alignnone size-medium wp-image-395" title="BackTrack Ready to Install" src="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-ready-to-install-300x217.png" alt="BackTrack Ready to Install" width="300" height="217" /></noscript></a><br />
BackTrack installation summary; click to enlarge</div>
<p>17. BackTrack is now installing! Wait patiently; this can take a while depending on how much RAM you allocated and how fast your PC is!</p>
<div class="photocap"><a href="http://www.techblogistech.com/wp-content/uploads/2011/08/installing-backtrack.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-391" title="Installing Backtrack" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/installing-backtrack-300x247.png" alt="Installing Backtrack" width="300" height="247" /><noscript><img class="alignnone size-medium wp-image-391" title="Installing Backtrack" src="http://www.techblogistech.com/wp-content/uploads/2011/08/installing-backtrack-300x247.png" alt="Installing Backtrack" width="300" height="247" /></noscript></a><br />
Installing BackTrack to the hard drive; click to enlarge</div>
<p>18. You&#8217;re done installing! Restart!<br />
19. When BackTrack boots, use the username <strong>root</strong> and the password <strong>toor</strong> to login. Change the password using <strong>passwd</strong>.<br />
20. You may have noticed you&#8217;re at a duller black screen instead of the cool splash screen you had during the live session. If you think this is hardcore, then good for you! If you liked the splash screen better then use <strong>fix-splash</strong> to restore it!<br />
<a href="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-restore-boot-splash-reboot.png" rel="shadowbox[sbpost-390];player=img;"><img class="lazy alignnone size-medium wp-image-396" title="BackTrack Restore Boot Splash" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-restore-boot-splash-reboot-300x151.png" alt="BackTrack Restore Boot Splash" width="300" height="151" /><noscript><img class="alignnone size-medium wp-image-396" title="BackTrack Restore Boot Splash" src="http://www.techblogistech.com/wp-content/uploads/2011/08/backtrack-restore-boot-splash-reboot-300x151.png" alt="BackTrack Restore Boot Splash" width="300" height="151" /></noscript></a><br />
21. If you fixed the splash screen, go ahead and reboot again using <strong>shutdown -r now</strong>.</p>
<h1>Finish Line</h1>
<p>Congratulations! You&#8217;re all done! Go forth and prosper! Don&#8217;t forget you can still use <strong>startx</strong> to get back to your desktop environment if you want to use the GUI tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/08/installing-backtrack-in-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheat Sheet for gzip, bzip2, zip and tar</title>
		<link>http://www.techblogistech.com/2011/07/cheat-sheet-for-gzip-bzip2-zip-and-tar/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cheat-sheet-for-gzip-bzip2-zip-and-tar</link>
		<comments>http://www.techblogistech.com/2011/07/cheat-sheet-for-gzip-bzip2-zip-and-tar/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 22:53:02 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bunzip]]></category>
		<category><![CDATA[bz2]]></category>
		<category><![CDATA[bzip]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[gunzip]]></category>
		<category><![CDATA[gz]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tbz2]]></category>
		<category><![CDATA[tgz]]></category>
		<category><![CDATA[unzip]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=77</guid>
		<description><![CDATA[Here&#8217;s a cheat-sheet for using gzip, bzip2, zip and tar! This should come in handy when handling archives. Footnote: If &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/07/cheat-sheet-for-gzip-bzip2-zip-and-tar/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" rel="shadowbox[sbpost-77];player=img;"><img class="lazy alignright size-full wp-image-97" title="Archive" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" alt="File Archiver" width="77" height="77" /><noscript><img class="alignright size-full wp-image-97" title="Archive" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" alt="File Archiver" width="77" height="77" /></noscript></a>Here&#8217;s a cheat-sheet for using gzip, bzip2, zip and tar! This should come in handy when handling archives.</p>
<p><strong>Footnote</strong>: If you need more detail about archiving and compressing, check out <a title="How to Archive and Compress and Back Again (using zip, gzip, bzip2, and tar in terminal)" href="http://www.techblogistech.com/2011/07/how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal/">the guide</a>!</p>
<p><span id="more-77"></span></p>
<table>
<tbody>
<tr>
<td>Tar a Directory</td>
<td>
<pre>tar cvf archive.tar /home/user/directory</pre>
</td>
</tr>
<tr>
<td>Tar + Bzip2 a Directory</td>
<td>
<pre>tar cjvf archive.tar.bz2 /home/user/directory</pre>
</td>
</tr>
<tr>
<td>Tar + Gzip a Directory</td>
<td>
<pre>tar czvf archive.tgz /home/user/directory</pre>
</td>
</tr>
<tr>
<td>Zip a Directory</td>
<td>
<pre>zip -r archive.zip /home/user/directory</pre>
</td>
</tr>
<tr>
<td>Extract a Tar + Bzip2 Archive</td>
<td>
<pre>tar xjvf archive.tar.bz2</pre>
</td>
</tr>
<tr>
<td>Extract a Tar + Gzip Archive</td>
<td>
<pre>tar xzvf archive.tgz</pre>
</td>
</tr>
<tr>
<td>Extract a Zip Archive</td>
<td>
<pre>unzip archive.zip</pre>
</td>
</tr>
<tr>
<td>View the Contents of a Tar + Bzip2 Archive</td>
<td>
<pre>tar tjvf archive.tar.bz2</pre>
</td>
</tr>
<tr>
<td>View the Contents of a Tar + Gzip Archive</td>
<td>
<pre>tar tzvf archive.tgz</pre>
</td>
</tr>
<tr>
<td>View the Contents of a Zip Archive</td>
<td>
<pre>unzip -l archive.zip</pre>
</td>
</tr>
</tbody>
</table>
<p>Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/07/cheat-sheet-for-gzip-bzip2-zip-and-tar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Archive and Compress and Back Again (using zip, gzip, bzip2, and tar in terminal)</title>
		<link>http://www.techblogistech.com/2011/07/how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal</link>
		<comments>http://www.techblogistech.com/2011/07/how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 22:20:28 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bunzip]]></category>
		<category><![CDATA[bz2]]></category>
		<category><![CDATA[bzip]]></category>
		<category><![CDATA[gunzip]]></category>
		<category><![CDATA[gz]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tbz2]]></category>
		<category><![CDATA[tgz]]></category>
		<category><![CDATA[unzip]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=64</guid>
		<description><![CDATA[Plenty of linux users enjoy working from the command line; from manipulating files to compiling software, many users never seem &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/07/how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" rel="shadowbox[sbpost-64];player=img;"><img class="lazy alignright size-full wp-image-97" title="Archive" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" alt="File Archiver" width="77" height="77" /><noscript><img class="alignright size-full wp-image-97" title="Archive" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-utilities-file-archiver.png" alt="File Archiver" width="77" height="77" /></noscript></a>Plenty of linux users enjoy working from the command line; from manipulating files to compiling software, many users never seem to leave the terminal. Something that I do all the time at the terminal is archiving and unarchiving files as well as compressing them. Today I&#8217;ll demonstrate the necessary commands to do this using a few of the most common compression schemes so that you too can handle archives like the pros.</p>
<p><strong>Footnote</strong>: If you know what you&#8217;re doing already, you might like <a title="Cheat Sheet for gzip, bzip2, zip and tar" href="http://www.techblogistech.com/2011/07/cheat-sheet-for-gzip-bzip2-zip-and-tar/">the cheat-sheet</a> better!</p>
<p><span id="more-64"></span></p>
<p>We&#8217;ll start with compressing a single file because that&#8217;s the easiest thing to do and we&#8217;ll work our way to archiving and compressing directories.</p>
<h1>Gzip Files</h1>
<p><strong>Creating a gzipped file</strong> is as simple as typing <strong>gzip</strong> followed by the filename:</p>
<pre class="bigbash">$ gzip bank_statement</pre>
<p>This will output a file with a <strong>gz</strong> extension indicating it has been compressed: <strong>bank_statement.gz</strong>. Simple enough.</p>
<p><strong>Decompressing a gzipped file</strong> is just as simple using the <strong>gunzip</strong> command followed by the filename:</p>
<pre class="bigbash">$ gunzip bank_statement.gz</pre>
<p>This will output the original file <strong>without the gz</strong> extension indicating it has been decompressed: <strong>bank_statement</strong>.</p>
<h1>Bzip2 Files</h1>
<p><strong>Creating a bzipped file</strong> works identically to gzip; simply type <strong>bzip2</strong> followed by the filename:</p>
<pre class="bigbash">$ bzip2 bank_statement</pre>
<p>This will output a file with a <strong>bz2</strong> extension indicating it has been compressed: <strong>bank_statement.bz2</strong>.</p>
<p><strong>Decompressing a bzipped file</strong> works just like you would expect. Use the <strong>bunzip2</strong> command followed by the filename:</p>
<pre class="bigbash">$ bunzip2 bank_statement.bz2</pre>
<p>This will output the original file <strong>without the bz2</strong> extension indicating it has been decompressed: <strong>bank_statement</strong>.</p>
<h1>Tar Archives</h1>
<p><strong>Creating a tar archive</strong> allows you to group multiple files or directories into a single file. Windows users might find this similar to a <strong>zip</strong> file. One difference is that <strong>tar</strong> simply groups files together but does not compress them the way <strong>zip</strong> does. To create a tar archive we will use the <strong>tar</strong> command, the filename of the archive to create, and the files or directories you want to archive.</p>
<h3>Archiving a Single File</h3>
<p>To archive a file you would use a command similar to this:</p>
<pre class="bigbash">$ tar cf bank_statement.tar /home/user/bank_statement</pre>
<p>This will output a file named <strong>bank_statement.tar</strong> that contains <strong>/home/user/bank_statement</strong>. The flags used here are:</p>
<ul>
<li><strong>c</strong>: create an archive</li>
<li><strong>f</strong>: specifies that the argument following is the filename for the archive</li>
</ul>
<p>The file to archive doesn&#8217;t have to be the full path; you can just as easily use these commands to change to the <strong>/home/user</strong> directory and <strong>tar</strong> the <strong>bank_statement</strong>:</p>
<pre class="bigbash">$ cd /home/user
$ tar cf bank_statement.tar bank_statement</pre>
<h3>Archiving Multiple Files or Directories</h3>
<p>Typically you wouldn&#8217;t want to <strong>tar</strong> a single file though. It&#8217;s more useful to tar multiple files or directories like the following respective commands:</p>
<pre class="bigbash">$ tar cf some_important_documents.tar bank_statement tax_document
$ tar cf all_important_documents.tar /home/user/important_documents/</pre>
<p>The first command will output a file named <strong>some_important_documents.tar</strong> that contains both <strong>bank_statement</strong> and <strong>tax_document</strong>, while the second command will output a file named <strong>all_important_documents.tar</strong> that contains the entire contents of the <strong>important_documents</strong> directory. Now we&#8217;re getting somewhere!</p>
<h3>Unarchiving</h3>
<p><strong>Unarchiving a tar file</strong> uses the <strong>tar</strong> command followed by the archive file name. Instead of the <strong>c</strong> flag, we use <strong>x</strong> instead:</p>
<pre class="bigbash">$ tar xf some_important_documents.tar</pre>
<p>This will create the original files that were stored in the tar archive; in this case both <strong>bank_statement</strong> and <strong>tax_document</strong> would be output to the file system. The new flags used in that command are:</p>
<ul>
<li><strong>x</strong>: extract an archive</li>
</ul>
<p>Remember that the <strong>f</strong> is used to specify the archive filename.</p>
<h1>Gzipped Tar Archives</h1>
<p><strong>Creating a gzipped tar archive</strong> is very similar to creating a <strong>zip</strong> file in the Windows world because you achieve a compressed archive file that contains many other files. To create a <strong>tar</strong> archive and simultaneously <strong>gzip</strong> it, pass the <strong>z</strong> flag to tar:</p>
<pre class="bigbash">$ tar czf all_important_documents.tar.gz /home/user/important_documents/</pre>
<p>This will output the file <strong>all_important_documents.tar.gz</strong> which is a <strong>gzip</strong> compressed archive of the entire contents of the <strong>important_documents</strong> directory. The new flags used in that command are:</p>
<ul>
<li><strong>z</strong>: apply <strong>gzip</strong> when <strong>c</strong>reating an archive and <strong>gunzip</strong> when e<strong>x</strong>tracting an archive</li>
</ul>
<p><strong>Decompressing and extracting a gzipped tar archive</strong> is easy once you know how to create one. To reverse the process just swap the <strong>c</strong> flag for the <strong>x</strong> flag just like before:</p>
<pre class="bigbash">$ tar xzf all_important_documents.tar.gz</pre>
<p>This will create the original files that were stored in the tar archive; in this case the <strong>important_documents</strong> directory would be output to the file system.</p>
<h1>Bzipped Tar Archives</h1>
<p><strong>Creating a bzipped tar archive</strong> works just like the gzipped tar archive; just pass the <strong>j</strong> flag to tar instead of the <strong>z</strong> flag:</p>
<pre class="bigbash">$ tar cjf all_important_documents.tar.gz /home/user/important_documents/</pre>
<p>This will output the file <strong>all_important_documents.tar.gz</strong> which is a <strong>bzip2</strong> compressed archive of the entire contents of the <strong>important_documents</strong> directory. The new flags used in that command are:</p>
<ul>
<li><strong>j</strong>: apply <strong>bzip2</strong> when <strong>c</strong>reating an archive and <strong>bunzip2</strong> when e<strong>x</strong>tracting an archive</li>
</ul>
<p><strong>Decompressing and extracting a bzipped tar archive</strong> works the same, of course:</p>
<pre class="bigbash">$ tar xjf all_important_documents.tar.gz</pre>
<p>This will create the original files that were stored in the tar archive; in this case the <strong>important_documents</strong> directory would be output to the file system.</p>
<h1>Zip Files and Archives</h1>
<p><strong>Creating a zip file</strong> will seem suprisingly simple after reading about <strong>tar</strong> since it handles the compression automatically without you having to pick one.</p>
<h3>Zipping a Single File</h3>
<p>To zip a single file you just use the <strong>zip</strong> command followed by the archive filename and then the file you want to zip:</p>
<pre class="bigbash">$ zip bank_statement.zip bank_statement</pre>
<p>This will output a file named <strong>bank_statement.zip</strong> that contains <strong>bank_statement</strong>.</p>
<h3>Zipping Multiple Files</h3>
<p>To zip multiple files you just add more filenames after the archive name:</p>
<pre class="bigbash">$ zip some_important_documents.zip bank_statement tax_document</pre>
<p>This will output a file named <strong>some_important_documents.zip</strong> that contains both <strong>bank_statement</strong> and <strong>tax_document</strong>.</p>
<h3>Zipping Directories</h3>
<p>To zip a directory you can use the <strong>-r</strong> flag:</p>
<pre class="bigbash">$ zip -r all_important_documents.zip important_documents</pre>
<p>This will output a file named <strong>all_important_documents.zip</strong> that contains the entire contents of the <strong>important_documents</strong> directory.</p>
<h3>Extracting Zip Files</h3>
<p>To unzip a zip file, just use <strong>unzip</strong> followed by the filename:</p>
<pre class="bigbash">$ unzip all_important_documents.zip</pre>
<p>This will create the original files that were zipped; in this case the <strong>important_documents</strong> directory.</p>
<h1>Additional Tips</h1>
<p>And that&#8217;s all you need to know about archiving and compressing in linux (well, maybe not everything)! Here a few more tips that I find useful day-to-day:</p>
<ul>
<li>Before unzipping a file, try using the <strong>-l</strong> flag to view the contents of the archive first:
<pre class="bigbash">$ unzip -l unknown_zip_archive.zip</pre>
</li>
<li>Before untarring a file, try using the <strong>t</strong> flag to view the contents of the archive first:
<pre class="bigbash">$ tar tzf unknown_gzip_tar_file.tar.gz</pre>
</li>
<li>You might see <strong>gzipped</strong> tar files with the extension <strong>tar.gz</strong> or simply <strong>tgz</strong>. There is no difference, they are both <strong>gzip</strong> compressed tar files.</li>
<li>You might see <strong>bzipped</strong> tar files with the extension <strong>tar.bz2</strong>, <strong>tb2</strong>, or <strong>tbz2</strong>. There is no difference, they are all <strong>bzip2</strong> compressed tar files.</li>
<li>For more information when tarring and untarring archives (such as what files are going into the archive), try using the <strong>v</strong> flag to enable verbose output:
<pre class="bigbash">$ tar cvzf backup.tar.gz /home/user</pre>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/07/how-to-archive-and-compress-and-back-again-using-zip-gzip-bzip2-and-tar-in-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The difference between &#8216;rpm -Uvh&#8217; and &#8216;rpm -ivh&#8217; (or how to install packages in RHEL, CentOS or Fedora)</title>
		<link>http://www.techblogistech.com/2011/07/the-difference-between-rpm-uvh-and-rpm-ivh-or-how-to-install-packages-in-rhel-centos-or-fedora/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-difference-between-rpm-uvh-and-rpm-ivh-or-how-to-install-packages-in-rhel-centos-or-fedora</link>
		<comments>http://www.techblogistech.com/2011/07/the-difference-between-rpm-uvh-and-rpm-ivh-or-how-to-install-packages-in-rhel-centos-or-fedora/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 07:06:11 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.techblogistech.com/?p=45</guid>
		<description><![CDATA[When installing packages in RHEL, CentOS, or Fedora, chances are you use yum, the default package manager. But what if &#8230; <span class="more-link"><a href="http://www.techblogistech.com/2011/07/the-difference-between-rpm-uvh-and-rpm-ivh-or-how-to-install-packages-in-rhel-centos-or-fedora/">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-application-x-rpm.png" rel="shadowbox[sbpost-45];player=img;"><img class="lazy alignright size-full wp-image-108" title="RPM" src="http://www.techblogistech.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif" data-original="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-application-x-rpm.png" alt="RPM" width="77" height="77" /><noscript><img class="alignright size-full wp-image-108" title="RPM" src="http://www.techblogistech.com/wp-content/uploads/2011/07/oxygen-application-x-rpm.png" alt="RPM" width="77" height="77" /></noscript></a>When installing packages in RHEL, CentOS, or Fedora, chances are you use <a href="http://yum.baseurl.org/">yum</a>, the default package manager. But what if you want to download a package not provided in a repository? Or what if you just want to upgrade a package to the latest version and your repositories haven&#8217;t upgraded it yet?</p>
<p>Most users know that to install a package from an RPM, you simply use the <strong>rpm</strong> command. But a bit of perusing on the internet will show that people use various flags when installing packages:</p>
<ul>
<li>rpm -i</li>
<li>rpm -ivh</li>
<li>rpm -U</li>
<li>rpm -Uvh</li>
</ul>
<p>In this post we&#8217;ll examine the difference and whether or not you should care.</p>
<p><span id="more-45"></span></p>
<p>The simple truth is that the only flags that are truly important to most users are <strong>-i</strong> and <strong>-U</strong>.</p>
<h1>Using -i</h1>
<p>When using <strong>-i</strong> you tell the <strong>rpm</strong> package manager to install the package. For example to install htop version 0.8.3:</p>
<pre class="bigbash"># rpm -i htop-0.8.3-1.el5.rf.x86_64.rpm</pre>
<p>This command <strong>only</strong> installs htop version 0.8.3. It does not care if you have other versions of htop installed. If you do not have any other versions of htop installed this is probably the correct command to use. If you <span style="text-decoration: underline;">do</span> have other versions of htop installed, this is probably <span style="text-decoration: underline;">NOT</span> what you want to do.</p>
<h1>Using -U</h1>
<p>When using <strong>-U</strong> you tell the <strong>rpm</strong> package manager to upgrade the package. For example to upgrade htop to version 0.9:</p>
<pre class="bigbash"># rpm -U htop-0.9-1.el5.rf.x86_64.rpm</pre>
<p>This command <strong>not only</strong> installs htop version 0.9, <strong>but also</strong> removes any other versions of htop that are installed. The great thing about using <strong>-U</strong> is that even if you don&#8217;t have other versions of the software installed, it will still install the version you requested. In this way you can think of <strong>-U</strong> as a more careful version of <strong>-i</strong>. <strong>In nearly every practical case you want to use -U!</strong></p>
<h1>But what about -v and -h?</h1>
<p>The <strong>-v</strong> and <strong>-h</strong> flags are just to print more verbose information regarding the installation or upgrade. These are <strong>optional</strong>, but <strong>useful</strong> parameters. Below is the information from the <strong>man page</strong>:</p>
<pre>-v Print verbose information - normally routine progress messages will be displayed.
-h, --hash Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.</pre>
<h1>How can I learn more about rpm?</h1>
<p>If you want to learn how to use other features of <strong>rpm</strong>, I would suggest using the <strong>man page</strong> by typing this at terminal:</p>
<pre class="bigbash"># man rpm</pre>
<p>Man pages aren&#8217;t nearly as scary as people make them out to be. They provide plenty of helpful information and they&#8217;re always the first place to turn when looking for help with a command.</p>
<p>If you want more information about the RPM Package Manager or the RPM format, you might try <a href="http://en.wikipedia.org/wiki/RPM_Package_Manager">Wikipedia&#8217;s article</a> first or even <a href="http://www.google.com/search?q=rpm+package+manager">Google</a>.</p>
<p>&#8212;</p>
<p>In conclusion, any good admin should understand every command he or she uses at least in some detail. But for the common case, <strong>rpm -U</strong> or <strong>rpm -Uvh</strong> should serve you well.</p>
<p>Happy hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techblogistech.com/2011/07/the-difference-between-rpm-uvh-and-rpm-ivh-or-how-to-install-packages-in-rhel-centos-or-fedora/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
