<?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>Wed, 22 Feb 2012 02:44:46 +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>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>
		<item>
		<title>Linux ln command examples</title>
		<link>http://www.linuxexamples.com/linux-ln-command-examples/</link>
		<comments>http://www.linuxexamples.com/linux-ln-command-examples/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 08:19:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=121</guid>
		<description><![CDATA[We can use linux ln command to make link between files,and there are 2 kinds of link,hard link and symbolic link.

<strong>Difference between hard link and symbolic link</strong>

1.Hard link can't be used for directory or cross file system.Symbolic link can do this

2.Remove the original of the hard link does not remove the actual data,we can still access the data by the hard link,but

if the original file or directory of a symbolic link was removed ,then the actual data lost,and we can't access the data anyway

3.Hard link won't use a new block(inode),but symbolic link will.So in theory symbolic link will occupy more disk space(inodes)

4.Symbolic link is used more than hard link

&#160;

<strong>Examples:</strong>

1.Create a hard link use ln command
<pre lang="bash">j@J:~$ touch a.txt
j@J:~$ echo "Test..." &#62; a.txt
j@J:~$ cat a.txt
Test...
j@J:~$ ln a.txt hardlink.txt
j@J:~$ ls -il *.txt
35226 -rw-rw-r-- 2 j j 8 2012-02-12 16:08 a.txt
35226 -rw-rw-r-- 2 j j 8 2012-02-12 16:08 hardlink.txt
j@J:~$ cat hardlink.txt
Test...
j@J:~$ rm -f a.txt
j@J:~$ cat hardlink.txt
Test...
j@J:~$</pre>
The above examples make a hard link hardlink.txt to a.txt,we can see the 2 files use the same inode,also if you remove the original file a.txt,we still can access hardlink.txt and the data is still there

2.Create a symblic file with option -s
<pre lang="bash">j@J:~$ touch a.txt
j@J:~$ echo "Test..." &#62; a.txt
j@J:~$ cat a.txt
Test...
j@J:~$ ln a.txt hardlink.txt
j@J:~$ ls -il *.txt
35226 -rw-rw-r-- 2 j j 8 2012-02-12 16:08 a.txt
35226 -rw-rw-r-- 2 j j 8 2012-02-12 16:08 hardlink.txt
j@J:~$ cat hardlink.txt
Test...
j@J:~$ rm -f a.txt
j@J:~$ cat hardlink.txt
Test...
j@J:~$</pre>
The above example create a symbolic link to a.txt ,and we also can see the 2 files use the different inode (block),and if we remove the original file,the symbolic link will be unaccessable.

3.Create a symbolic link for a directory.
<pre lang="bash">j@J:~$ ln -s /var/log .</pre>
The above example just make a symbolic link for directory /var/log in current directory

4.To remove a link ,just use "rm linkname"
<pre lang="bash">j@J:~$ ls -l log
lrwxrwxrwx 1 j j 8 2012-02-12 16:14 log -&#62; /var/log
j@J:~$ rm log
j@J:~$</pre>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-ln-command-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux mount command examples</title>
		<link>http://www.linuxexamples.com/linux-mount-command-examples/</link>
		<comments>http://www.linuxexamples.com/linux-mount-command-examples/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 09:07:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=115</guid>
		<description><![CDATA[We can use mount command in linux to mount a filesystem ,for example, ext3 /ext4 file system or nfs or iso or cdrom or usb disk.

Pls see below examples to know how to mount these file system.

1.Mount a nfs file system

<code>mount  remotehostname:sharepoint   /mountpoint</code>

eg:
<pre lang="bash"># mount server2:/u/data /mnt</pre>
2.Mount an ISO image file in linux
<pre lang="bash"># mount -o loop disk1.iso /mnt</pre>
3.Mount usb disk in linux

a)use command "fdisk -l" to check the detail path of your usb disk,eg:we get the path is /dev/sdb1
<pre lang="bash">#fdisk -l</pre>
b) then use mount command to mount it ,eg:mount to /mnt
<pre lang="bash">#mount /dev/sdb1 /mnt</pre>
4.Mount cd or dvd rom (Please intert your cd or dvd firstly)
<pre lang="bash">#mount -t iso9660 -o ro /dev/cdrom /cdrom</pre>
5.Umount a file system
<pre lang="bash"># umount DIR</pre>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-mount-command-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux kill command examples</title>
		<link>http://www.linuxexamples.com/linux-kill-command-examples/</link>
		<comments>http://www.linuxexamples.com/linux-kill-command-examples/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 08:22:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=110</guid>
		<description><![CDATA[We can use linux command kill to terminate a process ,below will show you several examples:

<strong>Usage:</strong>

<code>kill [ -s signal &#124; -p ] [ -a ] [ -- ] pid ...</code>

<strong>Examples:</strong>

1.Kill xclock process using command kill ,firstly we use command ps to find the process id of xclock then kill it
<pre lang="bash">bash-3.2$ ps aux &#124;grep xclock
user01   28369  0.0  0.0 105424  3164 pts/421  S+   15:56   0:00 xclock
user01   28856  0.0  0.0  61140   760 pts/427  R+   15:56   0:00 grep xclock
bash-3.2$ kill 28369
bash-3.2$ ps aux &#124;grep xclock
user01   29288  0.0  0.0  61140   760 pts/427  R+   15:57   0:00 grep xclock
bash-3.2$</pre>
2.Sometimes the kill could not kill the process normally and we can add option "-9" to kill it forcely
<pre lang="bash">bash-3.2$ ps aux &#124;grep xclock
user01    6954  0.0  0.0 105424  3164 pts/57   S+   16:00   0:00 xclock
user01    7172  0.0  0.0 105424  3164 pts/421  S+   16:00   0:00 xclock
user01    7207  0.0  0.0  61144   768 pts/427  S+   16:00   0:00 grep xclock
bash-3.2$ kill -9 6954 7172
bash-3.2$</pre>
3.Use kill -HUP to let process to reload it's configurations.Examples,if we changed /etc/xinetd.conf ,we can use below command to let process xinetd to reload the configuration file with terminating the process and start again.
<pre lang="bash">bash-3.2$ ps -ef &#124;grep xinetd
root      3325     1  0  2011 ?        00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
user01   11435 10695  0 16:06 pts/427  00:00:00 grep xinetd
bash-3.2$ kill -HUP 3325
bash-3.2$</pre>
4.Kill all your own processes with option  "-1 -1" (Both are number one)
<pre lang="bash">bash-3.2$ kill -1 -1</pre>
5.Use command killall the kill process by spcecify it's process name but not process id
<pre lang="bash">bash-3.2$ killall -HUP xinetd</pre>
&#160;]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-kill-command-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux find command examples</title>
		<link>http://www.linuxexamples.com/linux-find-command-examples/</link>
		<comments>http://www.linuxexamples.com/linux-find-command-examples/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 07:03:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=60</guid>
		<description><![CDATA[Linux find command could be used to search for files in a directory hierarchy.

<strong>SYNOPSIS</strong>
<pre lang="text">find [-H] [-L] [-P] [path...] [expression]</pre>
<strong>Examples:</strong>(From find manpage)
<pre lang="bash">find /tmp -name core -type f -print &#124; xargs /bin/rm -f</pre>
Find files named core in or below the directory /tmp and delete them.  Note that this will work incorrectly if
there are any filenames containing newlines, single or double quotes, or spaces.
<pre lang="bash">find /tmp -name core -type f -print0 &#124; xargs -0 /bin/rm -f</pre>
Find  files named core in or below the directory /tmp and delete them, processing filenames in such a way that
file or directory names containing single or double quotes, spaces or newlines  are  correctly  handled.   The
-name test comes before the -type test in order to avoid having to call stat(2) on every file.
<pre lang="bash">find . -type f -exec file {} \;</pre>
Runs  file  on  every file in or below the current directory.  Notice that the braces are enclosed in single
quote marks to protect them from interpretation as shell script punctuation.   The semicolon is similarly pro-
tected by the use of a backslash, though ; could have been used in that case also.
<pre lang="bash">find /    \( -perm -4000 -fprintf /root/suid.txt %#m %u %p\n \) , \
\( -size +100M -fprintf /root/big.txt %-10s %p\n \)</pre>
Traverse  the  filesystem  just once, listing setuid files and directories into /root/suid.txt and large files
into /root/big.txt.
<pre lang="bash">find $HOME -mtime 0</pre>
Search for files in your home directory which have been modified in the last twenty-four hours.  This  command
works  this way because the time since each file was last modified is divided by 24 hours and any remainder is
discarded.  That means that to match -mtime 0, a file will have to have a modification in the  past  which  is
less than 24 hours ago.
<pre lang="bash">find . -perm 664</pre>
Search  for  files  which have read and write permission for their owner, and group, but which other users can
read but not write to.  Files which meet these criteria but have other permissions bits set  (for  example  if
someone can execute the file) will not be matched.
<pre lang="bash">find . -perm -664</pre>
Search  for  files  which  have read and write permission for their owner and group, and which other users can
read, without regard to the presence of any extra permission bits (for example the executable bit).  This will
match a file which has mode 0777, for example.
<pre lang="bash">find . -perm /222</pre>
Search for files which are writable by somebody (their owner, or their group, or anybody else).
<pre lang="bash">find . -perm /220
find . -perm /u+w,g+w
find . -perm /u=w,g=w</pre>
All  three  of  these  commands do the same thing, but the first one uses the octal representation of the file
mode, and the other two use the symbolic form.  These commands all search for  files  which  are  writable  by
either  their  owner  or  their  group.  The files dont have to be writable by both the owner and group to be
matched; either will do.
<pre lang="bash">find . -perm -220
find . -perm -g+w,u+w</pre>
Both these commands do the same thing; search for files which are writable  by  both  their  owner  and  their
group.
<pre lang="bash">find . -perm -444 -perm /222 ! -perm /111
find . -perm -a+r -perm /a+w ! -perm /a+x</pre>
These  two  commands both search for files that are readable for everybody (-perm -444 or -perm -a+r), have at
least on write bit set (-perm /222 or -perm /a+w) but are not executable for anybody  (!   -perm  /111  and  !
-perm /a+x respectively)]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/linux-find-command-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gzip command examples in linux</title>
		<link>http://www.linuxexamples.com/gzip-command-examples-linux/</link>
		<comments>http://www.linuxexamples.com/gzip-command-examples-linux/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 06:25:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Command]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.linuxexamples.com/?p=90</guid>
		<description><![CDATA[Linux command gzip is used to compress files or extract .gz files,below will show you some examples.

1.Compress file01 to file01.gz with gzip command
<pre lang="bash">bash-3.2$ ls
dir1  file01
bash-3.2$ gzip file01
bash-3.2$ ls
dir1  file01.gz
bash-3.2$</pre>
2.Compress file01 to file01.gz with option -c to keep original file file01 untouched
<pre lang="bash">bash-3.2$ ls
dir1  file01
bash-3.2$ gzip -c file01 &#62; file01.gz
bash-3.2$ ls
dir1  file01  file01.gz
bash-3.2$</pre>
3.Regulate the speed of compression  using the specified digit number(1-9),where -1 or --fast indicates the fastest
compression method (less compression) and -9 or --best indicates the slowest compression  method  (best
compression).  The default compression level is -6 (that is, biased towards high compression at expense
of speed).
<pre lang="bash">bash-3.2$ ls
dir1  file01
bash-3.2$ ls -lh file01
-rw-r----- 1 user1 group1 71K Feb  9 14:04 file01
bash-3.2$ gzip -c file01 &#62; file01-default.gz
bash-3.2$ gzip -c -1 file01 &#62; file01-1.gz
bash-3.2$ gzip -c -9 file01 &#62; file01-9.gz
bash-3.2$ ls -lh file01*
-rw-r----- 1 user1 group1  71K Feb  9 14:04 file01
-rw-r----- 1 user1 group1  10K Feb  9 14:11 file01-1.gz
-rw-r----- 1 user1 group1 7.2K Feb  9 14:11 file01-9.gz
-rw-r----- 1 user1 group1 7.2K Feb  9 14:11 file01-default.gz
bash-3.2$ ls -l file01*
-rw-r----- 1 user1 group1 72393 Feb  9 14:04 file01
-rw-r----- 1 user1 group1 10195 Feb  9 14:11 file01-1.gz
-rw-r----- 1 user1 group1  7322 Feb  9 14:11 file01-9.gz
-rw-r----- 1 user1 group1  7365 Feb  9 14:11 file01-default.gz
bash-3.2$</pre>
4.Using command zcat the see the content of the .gz file
<pre lang="bash">bash-3.2$ ls
dir1  file01.gz
bash-3.2$ zcat file01.gz
...etc.</pre>
5.Using command zcat the calculate the true size(in Bytes) of the uncompressed files
<pre lang="bash">bash-3.2$ zcat file01.gz&#124;wc -c
72393
bash-3.2$</pre>
6.Extract a .gz file using command gzip with option -d (of course you can use command gunzip directly)
<pre lang="bash">bash-3.2$ ls
dir1  file01.gz
bash-3.2$ gzip -d file01.gz
bash-3.2$ ls
dir1  file01
bash-3.2$</pre>]]></description>
		<wfw:commentRss>http://www.linuxexamples.com/gzip-command-examples-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

