<?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>Linux, Programming, Telephony, Asterisk, Apache, Tips &#38; Tricks &#187; Linux Commands</title>
	<atom:link href="http://shahidz.com/category/linux/commands/feed/" rel="self" type="application/rss+xml" />
	<link>http://shahidz.com</link>
	<description>Passionate About Technology</description>
	<lastBuildDate>Sun, 10 Jan 2010 17:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux Date Command Option</title>
		<link>http://shahidz.com/linux-date-command-option/</link>
		<comments>http://shahidz.com/linux-date-command-option/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 05:59:13 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[option]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=77</guid>
		<description><![CDATA[Date command options.
Date command to get the current date.
$ date=$(date +%Y-%m-%d)
$ echo $date
Date command to get yesterday&#8217;s date.
$ date=$(date --date=yesterday +%Y-%m-%d)
$ echo $date
Date command to get tomorrow&#8217;s date.
$ date=$(date --date=tomorrow +%Y-%m-%d)
$ echo $date
]]></description>
			<content:encoded><![CDATA[<p><strong>Date command options.</strong></p>
<p>Date command to get the current date.</p>
<pre>$ date=$(date +%Y-%m-%d)
$ echo $date</pre>
<p>Date command to get yesterday&#8217;s date.</p>
<pre>$ date=$(date --date=yesterday +%Y-%m-%d)
$ echo $date</pre>
<p>Date command to get tomorrow&#8217;s date.</p>
<pre>$ date=$(date --date=tomorrow +%Y-%m-%d)
$ echo $date</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Flinux-date-command-option%2F&amp;linkname=Linux%20Date%20Command%20Option"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/linux-date-command-option/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ufw &#8211; Uncomplicated Firewall</title>
		<link>http://shahidz.com/ufw-uncomplicated-firewall/</link>
		<comments>http://shahidz.com/ufw-uncomplicated-firewall/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 16:12:17 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Iptables]]></category>
		<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[ufw]]></category>

		<guid isPermaLink="false">http://shahidz.com/ufw-uncomplicated-firewall/</guid>
		<description><![CDATA[Description
ufw is stands for Uncomplicated Firewall, this program is for managing a Linux firewall and aims to provide an easy to use interface for the user, as well as support package integration and dynamic-detection of open ports. ufw  is not intended to provide complete firewall functionality via its command interface, but instead provides an easy [...]]]></description>
			<content:encoded><![CDATA[<h3>Description</h3>
<p align="justify">ufw is stands for Uncomplicated Firewall, this program is for managing a Linux firewall and aims to provide an easy to use interface for the user, as well as support package integration and dynamic-detection of open ports. ufw  is not intended to provide complete firewall functionality via its command interface, but instead provides an easy way to  add  or  remove simple rules. It is currently mainly used for host-based firewalls.</p>
<h3 align="justify">Installation</h3>
<pre>$ sudo apt-get install ufw</pre>
<p>For help use</p>
<pre>$ man ufw</pre>
<p>To enable firewall</p>
<pre>$ sudo ufw enable</pre>
<p>When we enable the firewall it will set firewall with default settings, it will deny ssh ports, telnet and many other services. So when we enable firewall on the remort servers we must enable ssh ports first, this can done using.</p>
<pre>$ ufw allow proto tcp from any to any port 22</pre>
<p>To disable a firewall</p>
<pre>$ sudo sfw disable</pre>
<p>Examples</p>
<p>Deny all access to port 53:</p>
<pre>$ sudo ufw deny 53</pre>
<p>Allow all access to tcp port 80:</p>
<pre>$ sudo ufw allow 80/tcp</pre>
<p>Allow all access from RFC1918 networks to this host:</p>
<pre>$ sudo ufw allow from 10.0.0.0/8
$ sudo ufw allow from 172.16.0.0/12
$ sudo ufw allow from 192.168.0.0/16</pre>
<p>Deny access to udp port 514 from host 1.2.3.4:</p>
<pre>$ sudo ufw deny proto udp from 1.2.3.4 to any port 514</pre>
<p>Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:</p>
<pre>$ sudo ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fufw-uncomplicated-firewall%2F&amp;linkname=ufw%20%26%238211%3B%20Uncomplicated%20Firewall"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/ufw-uncomplicated-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen Command In Linux</title>
		<link>http://shahidz.com/screen-command-in-linux/</link>
		<comments>http://shahidz.com/screen-command-in-linux/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 07:22:32 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[virtual terminal]]></category>

		<guid isPermaLink="false">http://shahidz.com/screen-command-in-linux/</guid>
		<description><![CDATA[Introduction
When screen is called, it creates a single window with a  shell  in  it and then gets out of your way so that you can use the program as you normally would.  Then, at any time, you  can create new windows with other programs in them (including more shells), kill existing windows, view a list [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>When screen is called, it creates a single window with a  shell  in  it and then gets out of your way so that you can use the program as you normally would.  Then, at any time, you  can create new windows with other programs in them (including more shells), kill existing windows, view a list of windows, turn  output  logging  on and off, copy-and-paste text between windows, view the scroll back history, switch between windows in whatever manner you wish, etc.  All  windows  run  their  programs completely independent of each other.  Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user’s terminal.  When a program terminates, screen (per  default)  kills  the window  that  contained  it.  If this window was in the foreground, the display switches to the previous  window;  if  none  are  left,  screen exits.</p>
<p><strong> Usage</strong></p>
<p>To start screen us the command screen.</p>
<pre>$ screen</pre>
<p>In the virtual terminal you can start any applications as you normaly done in normal terminals. Even if you close the virtual terminal the application will continue running in the back ground.</p>
<p>To list how many screens where on use the following command.</p>
<pre>$ screen -ls
There are screens on:
        6475.pts-8.user-desktop        (Attached)
        6400.pts-6.user-desktop        (Attached)
2 Sockets in /var/run/screen/S-user.</pre>
<p>To reattaches a screen session use the following command.</p>
<pre>$ screen -d -r 6400.pts-6.user-desktop</pre>
<p>To removed the distroyed sessions use the following command.</p>
<pre> $ screen -wipe</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fscreen-command-in-linux%2F&amp;linkname=Screen%20Command%20In%20Linux"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/screen-command-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a swap file</title>
		<link>http://shahidz.com/creating-a-swap-file-using-diskdump/</link>
		<comments>http://shahidz.com/creating-a-swap-file-using-diskdump/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 15:42:15 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[disk dump]]></category>
		<category><![CDATA[mkswap]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[swapoff]]></category>

		<guid isPermaLink="false">http://shahidz.com/creating-a-swap-file-using-diskdump/</guid>
		<description><![CDATA[Using the command dd you can create swap file.
dd &#8211; convert and copy a file 
First of all check the current swap size using the command &#8216;free&#8217;
$ free
Output
total       used       free     shared    buffers     [...]]]></description>
			<content:encoded><![CDATA[<p>Using the command <strong>dd </strong>you can create swap file.</p>
<p><strong>dd &#8211; convert and copy a file </strong></p>
<p>First of all check the current swap size using the command &#8216;free&#8217;</p>
<pre>$ free
<u>Output</u>
total       used       free     shared    buffers     cached
Mem:       1025620    1009140      16480          0       2252     465116
-/+ buffers/cache:     541772     483848
Swap:      2096440      18924    2077516</pre>
<p>Create a directory called &#8217;swap&#8217; under slash &#8216;/&#8217;</p>
<pre>$ sudo mkdir /swap</pre>
<p>First creat a file using dd command</p>
<p>Creates a file of size 1GB</p>
<pre>$ sudo dd if=/dev/zero of=/swap/swap.file bs=2048 count=524288</pre>
<p>Format this file ‘/swap/swap.file’ using the command ‘mkswap’</p>
<pre>$ mkswap /swap/swap.file</pre>
<p>Activate the ’swap.file’ to the current swap space using the command ’swapon’</p>
<pre>$ swapon /swap/swap.file</pre>
<p>After the above command 1GB will be added to you are swap area.</p>
<p>You can check by the command &#8216;free&#8217;</p>
<pre>$ free
             total       used       free     shared    buffers     cached
Mem:       1025620    1010660      14960          0       2620     465292
-/+ buffers/cache:     542748     482872
Swap:      3145008      18924    3126084</pre>
<p>You can remove the swap area by using the command &#8217;swapoff&#8217;</p>
<pre>$ swapoff /swap/swap.file</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fcreating-a-swap-file-using-diskdump%2F&amp;linkname=Creating%20a%20swap%20file"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/creating-a-swap-file-using-diskdump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backuping &amp; Restoring using mysqldump &amp; mysqlhotcopy</title>
		<link>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/</link>
		<comments>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 04:38:00 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[mysql backups]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[mysqlhotcopy]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=15</guid>
		<description><![CDATA[Using mysqldump
Using &#8216;mysqldump&#8217; command you can take the mysql database backup. This command all the datas to a text file.
The syntax is
shell&#62; mysqldump [options] db_name [tables]
shell&#62; mysqldump [options] –databases db_name1 [db_name2 db_name3…]
shell&#62; mysqldump [options] –all-databases
Backuping Examples:
shell&#62; mysqldump -u root -p dbaseName &#62; file.sql;
shell&#62; Enter the password
Restoring Example:
Suppose, we have the database as file.sql, and we [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using mysqldump</strong></p>
<p>Using &#8216;mysqldump&#8217; command you can take the mysql database backup. This command all the datas to a text file.</p>
<p>The syntax is</p>
<p>shell&gt; mysqldump [options] db_name [tables]<br />
shell&gt; mysqldump [options] –databases db_name1 [db_name2 db_name3…]<br />
shell&gt; mysqldump [options] –all-databases</p>
<p>Backuping Examples:</p>
<p>shell&gt; mysqldump -u root -p dbaseName &gt; file.sql;</p>
<p>shell&gt; Enter the password</p>
<p>Restoring Example:</p>
<p>Suppose, we have the database as file.sql, and we want to load it to the database, we can use &#8216;mysql&#8217; command to restore the database.</p>
<p>shell&gt; mysql -u root -p passwod dbaseName &lt; file.sql</p>
<p>shell&gt; Enter the password</p>
<p>Before executing this, make sure you are in the bin folder of mysql</p>
<p><strong>Using mysqlhotcopy</strong></p>
<p>Syntax:<br />
shell&gt;  mysqlhotcopy -u user <username> -p password dbname</p>
<password> <database> /backup/location/</database></password></username></p>
<p>Backuping Examples:<br />
shell&gt;  mysqlhotcopy -u user -p password mydb1 mydb2 /backup/location/</p>
<p>This will create a directory with the database name called ‘mydb1’ and &#8216;mydb2&#8242; in /backup/location/’</p>
<p>Restoring Example:<br />
To restore the backup you have to stop mysql using<br />
shell&gt; /etc/init.d/mysql stop</p>
<p>Then you have to copy the database backup file which is in the backup directory to the original mysql director which is ‘/var/lib/mysql/mysql1’</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fbackuping-restoring-using-mysqldump-mysqlhotcopy%2F&amp;linkname=Backuping%20%26%23038%3B%20Restoring%20using%20mysqldump%20%26%23038%3B%20mysqlhotcopy"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
