<?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 Examples</title>
	<atom:link href="http://www.linuxexamples.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linuxexamples.com</link>
	<description>Linux Command Examples</description>
	<lastBuildDate>Fri, 13 Apr 2012 07:23:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>clone solaris os to new hard disk</title>
		<link>http://www.linuxexamples.com/clone-solaris-os-new-hard-disk/</link>
		<comments>http://www.linuxexamples.com/clone-solaris-os-new-hard-disk/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 07:23:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[clone solairs]]></category>
		<category><![CDATA[new disk]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=187</guid>
		<description><![CDATA[Below steps will show you how to clone solaris OS (root partition) to new hard disk.

Note:Here I assume you only have one partition on your disks which are c0t0d0s0(old disk) and c0t1d0s0

&#160;

1.Power-off your Solaris machine (/sbin/init 5) ,and intert your new hard disk

2.Input "boot -s" to boot to single mode
<pre lang="text">boot -s</pre>
3.Go to below directory
<pre lang="text">cd /usr/platform/`uname -m`/lib/fs/ufs</pre>
4.Install bootblocks to your new disk partition using below command
<pre lang="text">./installboot ./bootblk /dev/rdsk/c0t1d0s0</pre>
5.Mount your new hard disk to /mnt (or other directory)
<pre lang="text">mount /dev/dsk/c0t1d0s0 /mnt</pre>
6.Using command ufsdump and ufsstore to dump clone your solaris OS to your new hard disk
<pre lang="text">cd /mnt

ufsdump 0bf 126 - / &#124; ufsrestore rf -</pre>
7.Replace c0t0d0s0 by c0t1d0s0 ,then done,you just cloned your Solaris root partition to your new hard disk]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/clone-solaris-os-new-hard-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix do_ypcall: clnt_call: RPC: Timed out</title>
		<link>http://www.linuxexamples.com/fix-do_ypcall-clnt_call-rpc-timed/</link>
		<comments>http://www.linuxexamples.com/fix-do_ypcall-clnt_call-rpc-timed/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 08:33:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[timed out]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=183</guid>
		<description><![CDATA[Error "Fix do_ypcall: clnt_call: RPC: Timed out" normally means a local problem on your system or site network which cause local

NIS client can't communicate with NIS server properly.

1.Check your system log messages to see if there are any network related errors,also you can check if your NIS server is pingable .

2.If no dubious problems been found,just use ps command to check if  /usr/sbin/nscd is running,start it if not
<blockquote>/usr/sbin/nscd</blockquote>
3.If step 2 still can't fix the problem,go to your NIS server ,then restart your NIS service
<blockquote>/etc/init.d/ypbind restart</blockquote>
Note:Step 3 resolved my "Fix do_ypcall: clnt_call: RPC: Timed out" error]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/fix-do_ypcall-clnt_call-rpc-timed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enlarge swap space in linux</title>
		<link>http://www.linuxexamples.com/enlarge-swap-space-linux/</link>
		<comments>http://www.linuxexamples.com/enlarge-swap-space-linux/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 06:58:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[dd swap]]></category>
		<category><![CDATA[enlarge swap]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=178</guid>
		<description><![CDATA[Swap space is very important in linux,if swap space is exhausted the system will crash,below will show to how to enlarge your swap space using file.

The same way you can add swap space if you have new disk installed.

&#160;

1.Use <a title="dd command examples" href="http://www.linuxexamples.com/linux-dd-command-examples/" target="_blank">dd command</a> to create a file to act as swap space.(below example create  a 16G file name swapfile under /tmp )
<blockquote>#dd if=/dev/zero of=/tmp/swapfile bs=1024 count=16000000</blockquote>
2.setup the file you created in step 1 as swap area
<blockquote>#/sbin/mkswap /tmp/swapfile</blockquote>
3.Enable the file as new swap space
<blockquote>/sbin/swapon /tmp/swapfile</blockquote>
4.If you want your change still take effect after system reboot ,just put the below line to your /etc/fstab file

#echo "/tmp/swapfile             swap                    swap    defaults        0 0" &#62;&#62; /etc/fstab

5.You can use below command to make sure if your swap space  been enlarged(the last line of output)
<blockquote>#free -m</blockquote>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/enlarge-swap-space-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix Acroread high cpu usage in linux</title>
		<link>http://www.linuxexamples.com/fix-acroread-high-cpu-usage-linux/</link>
		<comments>http://www.linuxexamples.com/fix-acroread-high-cpu-usage-linux/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 02:16:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[acroread]]></category>
		<category><![CDATA[high cpu]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=174</guid>
		<description><![CDATA[I found there was several acroread process which occupy high cpu on our linux vnc servers.I try to upgrade acroreader to the latest version which didn't work.

Now I found the reason is we are accessing internet behind company's proxy server and we don't configure the proxy setting for acroread,this is the root cause why

acroread occupy high cpu.

&#160;

<em><strong>Method 1 To fix acroread high cpu usage in linux</strong></em>

&#160;

If you are the only user who using the linux machine,after opening acroread, go to

<strong>Edit-Preferences-Internet</strong>

then set your proxy server and port in the right pane

&#160;

<em><strong>Method 2 To fix acroread high cpu usage in linux</strong></em>

If many users share the same linux machine,just go to your acrobat installation directory ,find file
<blockquote>i686-linux/Reader9/Reader/GlobalPrefs/reader_prefs</blockquote>
&#160;

Then add below codes (replace proxy address and port to your own) before the last line
<blockquote>/UnixProxyPreferences [/c &#60;&#60; /IsDirectConnection [/i 0]
/ProxyName [/s (myproxyserver)]
/ProxyPort [/i 1080]
&#62;&#62;]</blockquote>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/fix-acroread-high-cpu-usage-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy disk drive using dd command in linux</title>
		<link>http://www.linuxexamples.com/copy-disk-drive-dd-command-linux/</link>
		<comments>http://www.linuxexamples.com/copy-disk-drive-dd-command-linux/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 03:26:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=163</guid>
		<description><![CDATA[We can use dd command to copy the whole disk or one partition in linux, thus we can backup data or for copy OS purpose.

<span style="color: #ff0000;">Warning:Please make sure you are using the correct "if=" and "of=" parameters,or this will result in data lost</span>

&#160;

<em><strong>Copy whole disk using dd command</strong></em>

&#160;

Below command will copy disk sda to disk sdb
<blockquote># dd if=/dev/sda of=/dev/sdb</blockquote>
(Note:disk sdb will be formatted,so please make sure these is no useful data on /dev/sdb)
Also you can backup your disk and <a title="gzip command" href="http://www.linuxexamples.com/gzip-command-examples-linux/" target="_blank">gzip</a> it to image file
<blockquote># dd if=/dev/hda &#124; gzip &#62; /path/hdaimage.gz</blockquote>
&#160;

<em><strong>Copy disk partition using dd command</strong></em>

&#160;

Below examples will copy partition sda2 to partition sdb2 .(Please make sure no useful data on sdb2)
<blockquote>#dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror</blockquote>
The same as copy whole disk,you also can copy your partition to an image file
<blockquote># dd if=/dev/hda1 &#124; gzip &#62; /path/hda1image.gz</blockquote>
If you need to know more dd command examples,please refer:<a href="http://www.linuxexamples.com/linux-dd-command-examples/" rel="bookmark">linux dd command examples</a>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/copy-disk-drive-dd-command-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postfix/qmgr status=deferred (delivery temporarily suspended: transport is unavailable)</title>
		<link>http://www.linuxexamples.com/postfixqmgr/</link>
		<comments>http://www.linuxexamples.com/postfixqmgr/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 02:44:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=165</guid>
		<description><![CDATA[I have a crontab job to check something every day and send me the results to me via email,but today  no email received,and I found below error messages in mail log files



<blockquote>postfix/qmgr status=deferred (delivery temporarily suspended: transport is unavailable)</blockquote>



Then I just try to restart postfix service ,then I also got below error messages



<blockquote>postfix/local[4470]: fatal: open database /etc/postfix/aliases.db: No such file or directory</blockquote>



So the reason was found ,aliases.db file was missing,also my /etc/postfix/aliase file was missing,then I just did below steps to fix the issue



<blockquote>service postfix stop

cp /etc/aliases /etc/postfix/aliases

newaliases

service postfix start</blockquote>



&#160;

Hope this can help you ,good luck.]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/postfixqmgr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux chkconfig command example</title>
		<link>http://www.linuxexamples.com/linux-chkconfig-command/</link>
		<comments>http://www.linuxexamples.com/linux-chkconfig-command/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 04:46:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=155</guid>
		<description><![CDATA[Linux command chkconfig is used to updates and queries runlevel information for system services.
SYNOPSIS
<blockquote>chkconfig --list [name]
chkconfig --add name
chkconfig --del name
chkconfig [--level levels] name &#60;on&#124;off&#124;reset&#62;
chkconfig [--level levels] name</blockquote>
EXAMPLES:

1.Example to list all the serviced that chkconfig knows
<blockquote>chkconfig --list</blockquote>
2.Example to list a specified service's status ,below command list the status of service
<blockquote>bash-3.2$ chkconfig --list xinetd[root@server001 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off</blockquote>
3.Example to enable a specified service,below command just enable service mysqld
<blockquote>[root@server001 ~]# chkconfig mysqld on
[root@server001 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@server001 ~]#</blockquote>
4.Example to enable a service on at specified levels,below command enable mysqld on level 3 and 5
<blockquote>[root@server001 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@server001 ~]# chkconfig --level 35 mysqld on
[root@server001 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:on    4:off   5:on    6:off
[root@server001 ~]#</blockquote>
5.To delete a service from chkconfig management
<blockquote>chconfig --del service</blockquote>
6.To add a service for management by chkconfig(Make sure your service's script locates under /etc/init.d)
<blockquote>chkconfig --add service</blockquote>
&#160;

Note:About linux run levels
<blockquote>0: shutdown

1:single mode

2:multiple user mode without network

3.multiple user mode with network

4.Non-used,reserved for future

5.multiple user mode with network and gui mode

6.Reboot</blockquote>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-chkconfig-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux ssh automatic login without password prompt</title>
		<link>http://www.linuxexamples.com/linux-ssh-automatic-login-without-password-prompt/</link>
		<comments>http://www.linuxexamples.com/linux-ssh-automatic-login-without-password-prompt/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 05:30:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=148</guid>
		<description><![CDATA[If you need to use ssh to login another host every day,maybe you need to know how to use ssh automatic login to other host without password prompt,here we go

1.On the source host,run below command and hit ENTER 3 times to create rsa keys
<blockquote>user001@client[/home/user001]122% ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user001/.ssh/id_rsa):
Created directory '/home/user001/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user001/.ssh/id_rsa.
Your public key has been saved in /home/user001/.ssh/id_rsa.pub.
The key fingerprint is:
e1:b8:f0:db:09:02:8d:d6:30:59:66:0c:4e:9d:db:8d user001@client</blockquote>
2.ssh to the server with user user002 and create another .ssh directory under user002's home directory
<blockquote>user001@client[/home/user001]125% ssh user002@server mkdir -p .ssh
user001@server's password:
user001@client[/home/user001]126%</blockquote>
3.Copy the content of .ssh//id_rsa.pub to /home/user002/.ssh and rename to authorized_keys(if existed,just append)
<blockquote>user001@client[/home/user001]3% cat .ssh/id_rsa.pub &#124; ssh user002@server 'cat &#62;&#62;! .ssh/authorized_keys'
user001@server's password:
user001@client[/home/user001]4%</blockquote>
4.Done.Now you can ssh automatic login without password prompt

&#160;

Note:If the above steps not working,pls try:

1.Change permission of your .ssh directory to 770 using <a title="chmod command examples" href="http://www.linuxexamples.com/linux-chmod-examples/" target="_blank">chmod command</a> "chmod 700 .ssh"

2.Change the parent directory of .ssh to 750

3.Replace authorized_keys with authorized_keys2

&#160;

&#160;]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-ssh-automatic-login-without-password-prompt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>regular expression examples</title>
		<link>http://www.linuxexamples.com/regular-expression-examples/</link>
		<comments>http://www.linuxexamples.com/regular-expression-examples/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 08:49:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=133</guid>
		<description><![CDATA[<strong>Metacharacter regular expression examples</strong>
<blockquote><em><strong>. (dot)</strong></em></blockquote>
match any single character except line break characters \r and \n
<pre lang="bash">bash-3.2$ cat file.txt
abc
acc
add
bash-3.2$ sed 's/a.c/relaced/' file.txt
relaced
relaced
add
bash-3.2$</pre>
<blockquote><em><strong>[ ]</strong></em></blockquote>
A bracket expression. Matches a single character that is contained within the brackets
<pre lang="bash">user1@server1[/home/user1/examples]104% ls [a-c]*
a   b   c
user1@server1[/home/user1/examples]105% ls [0-9]*
1   2   3
user1@server1[/home/user1/examples]106% ls [a-c0-9]*
1   2   3   a   b   c
user1@server1[/home/user1/examples]107%</pre>
<blockquote><em><strong>[^ ]</strong></em></blockquote>
A bracket expression. Matches a single character that is not contained within the brackets
<pre lang="bash">user1@server1[/home/user1/examples]107% ls
./   ../  1    2    3    a    b    c
user1@server1[/home/user1/examples]108% ls [^0-9]*
a   b   c
user1@server1[/home/user1/examples]109% ls [^a-z]*
1   2   3
user1@sdc-master[/home/user1/examples]110% ls [^0-9a-z]*
ls: No match.
user1@server1[/home/user1/examples]111%</pre>
<blockquote><em><strong><code>^</code></strong></em></blockquote>
Matches at the start of the string the regex pattern is applied to, for examples  ^# matches  comment lines
<pre lang="bash">user1@server1[/home/user1/examples]120% cat examples.txt
This is the first line

#This is the 3rd line
This is the last line
user1@server1[/home/user1/examples]121% grep -v ^# examples.txt
This is the first line

This is the last line
user1@server1[/home/user1/examples]122%</pre>
<blockquote><em><strong>$</strong></em></blockquote>
Matches at the end of the string the regex pattern is applied to ,for examples  ^$ matches  empty lines
<pre lang="bash">user1@server1[/home/user/examples]122% grep -v ^$ examples.txt
This is the first line
#This is the 3rd line
This is the last line
user1@server1[/home/user1/examples]123%</pre>
<blockquote><em><strong>*</strong></em></blockquote>
Matches previous item zero or more times
<blockquote><em><strong>{n,m}</strong></em></blockquote>
Matches the preceding element at least <em>m</em> and not more than <em>n</em> times
<pre lang="bash">bash-3.2$ ls
a  aa  aaa  aaaa  aaaaa  examples.txt
bash-3.2$ ls &#124;grep 'a\{4,5\}'
aaaa
aaaaa
bash-3.2$ ls &#124;grep 'a\{1,5\}'
a
aa
aaa
aaaa
aaaaa
examples.txt
bash-3.2$ ls &#124;grep 'a\{2,5\}'
aa
aaa
aaaa
aaaaa
bash-3.2$</pre>
&#160;

&#160;]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/regular-expression-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux sed command examples</title>
		<link>http://www.linuxexamples.com/linux-sed-command-examples/</link>
		<comments>http://www.linuxexamples.com/linux-sed-command-examples/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 06:58:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=127</guid>
		<description><![CDATA[&#160;

Linux sed command is a powerful stream editor for filtering and transforming text.Below will show you several examples,after which you should can use sed to finish most basic tasks.

Below file will be used to do the tests in below examples
<pre lang="bash">bash-3.2$ cat example.txt
This is the first line
This is the second line
#This is the 3rd line

This is the 5th line
bash-3.2$</pre>
&#160;

<strong>Use sed command to replace matched text with replacement</strong>

1.The simplest replace,below example replace the first "is" to "IS" of every line in file example.txt
<pre lang="bash">bash-3.2$ sed 's/is/IS/' example.txt
ThIS is the first line
ThIS is the second line
#ThIS is the 3rd line

ThIS is the 5th line
bash-3.2$</pre>
2.Same as above example,but replace all "is" to "IS"
<pre lang="bash">bash-3.2$ sed 's/is/IS/g' example.txt
ThIS IS the first line
ThIS IS the second line
#ThIS IS the 3rd line

ThIS IS the 5th line
bash-3.2$</pre>
3.Example to do replace twice.(-e option is needed )
<pre lang="bash">bash-3.2$ sed -e 's/This/THIS/g' -e 's/the/THE/g' example.txt
THIS is THE first line
THIS is THE second line
#THIS is THE 3rd line

THIS is THE 5th line
bash-3.2$</pre>
&#160;

<strong>Use sed command to delete the lines matched</strong>

1.Remove comments lines
<pre lang="bash">bash-3.2$ sed '/^#/d' example.txt
This is the first line
This is the second line

This is the 5th line
bash-3.2$</pre>
2.Remove empty lines
<pre lang="bash">bash-3.2$ sed '/^$/d' example.txt
This is the first line
This is the second line
#This is the 3rd line
This is the 5th line
bash-3.2$</pre>
&#160;

<strong>Use sed command to instert append modify</strong>
<pre lang="bash">bash-3.2$ sed -e '/first/a\ THIS IS APPENED' example.txt
This is the first line
THIS IS APPENED
This is the second line
#This is the 3rd line

This is the 5th line
bash-3.2$ sed -e '/first/i\ THIS IS INSERTED' example.txt
THIS IS INSERTED
This is the first line
This is the second line
#This is the 3rd line

This is the 5th line
bash-3.2$ sed -e '/first/c\ THIS IS CHANGED' example.txt
THIS IS CHANGED
This is the second line
#This is the 3rd line

This is the 5th line
bash-3.2$</pre>
&#160;

<strong>Use sed command to transfer characters</strong>

Below example will transfer  c to x  ,d to y ,e to z
<pre lang="bash">bash-3.2$ sed  'y/cde/xyz/' example.txt
This is thz first linz
This is thz szxony linz
#This is thz 3ry linz

This is thz 5th linz
bash-3.2$</pre>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-sed-command-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

