<?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>remidian.com &#187; os commands</title>
	<atom:link href="http://remidian.com/category/nix/os-commands/feed" rel="self" type="application/rss+xml" />
	<link>http://remidian.com</link>
	<description>Braindumps of Remi Visser, freelance Oracle DBA.</description>
	<lastBuildDate>Mon, 10 May 2010 12:33:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>awk</title>
		<link>http://remidian.com/nix/os-commands/awk.html</link>
		<comments>http://remidian.com/nix/os-commands/awk.html#comments</comments>
		<pubDate>Sat, 13 Oct 2007 07:03:23 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>
		<category><![CDATA[awk]]></category>

		<guid isPermaLink="false">http://remidian.com/nix/os-commands/awk.html</guid>
		<description><![CDATA[Awk dumps. Count number of bytes in multiple directories I have been busy moveing (scp-ing/reorganising) large numer of databases over the network, this little awk script makes me able to count the number of bytes and thus check if my nighlty scp&#8217;s didn&#8217;t miss a byte. (or two) /cygdrive/c/oracle/oradata/DB01/DB01 $ find . -name &#34;*DBF&#34; -exec [...]]]></description>
			<content:encoded><![CDATA[<p>
Awk dumps.<span id="more-63"></span>
</p>
<h3>Count number of bytes in multiple directories</h3>
<p>I have been busy moveing (scp-ing/reorganising) large numer of databases over the network, this little awk script makes me able to count the number of bytes and thus check if my nighlty scp&#8217;s didn&#8217;t miss a byte. (or two)</p>
<pre>
/cygdrive/c/oracle/oradata/DB01/DB01
$ find . -name &quot;*DBF&quot; -exec ls -l {} \;
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 10493952 Oct&nbsp;&nbsp;9 16:49 ./DB01/DATAFILE/O1_MF_TEST_3HSWQYNH_.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 104865792 Oct&nbsp;&nbsp;9 16:49 ./EXAMPLE01.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 293412864 Oct&nbsp;&nbsp;9 16:49 ./P1PERG001.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 104865792 Oct&nbsp;&nbsp;9 16:49 ./P1PERG002.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 272637952 Oct 13 08:34 ./SYSAUX01.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 513810432 Oct&nbsp;&nbsp;9 16:49 ./SYSTEM01.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 20979712 Oct 13 08:36 ./TEMP01.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 47194112 Oct&nbsp;&nbsp;9 16:49 ./UNDOTBS01.DBF
-rwxrwx&#45;&#45;- 1 Administrators SYSTEM 5251072 Oct&nbsp;&nbsp;9 16:49 ./USERS01.DBF
&nbsp;
/cygdrive/c/oracle/oradata/DB01/DB01
$ find . -name &quot;*DBF&quot; -exec ls -l {} \; | awk &#039;
&gt; BEGIN { BYTES = 0 }
&gt; { BYTES = BYTES + $5 }
&gt; END { print &quot;Total number of bytes = &quot; BYTES}&#039;
Total number of bytes = 1373511680
&nbsp;
/cygdrive/c/oracle/oradata/DB01/DB01
$
&nbsp;
</pre>
<p>
Even shorter.
</p>
<pre>
find /m*/oradata/ai018001/ -name &quot;*dbf&quot; -exec ls -l {} \; | awk &#039;{B+=$5} END {print B}&#039;
&nbsp;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/awk.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ls</title>
		<link>http://remidian.com/nix/os-commands/ls.html</link>
		<comments>http://remidian.com/nix/os-commands/ls.html#comments</comments>
		<pubDate>Sun, 23 Sep 2007 16:43:53 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>

		<guid isPermaLink="false">http://remidian.com/uncategorized/ls.html</guid>
		<description><![CDATA[man: NAME: ls, ls &#8211; list directory contents Display only directories in current directory /cygdrive/c/temp $ ls -ld */ drwxr-xr-x+ 2 rz4tlj mkgroup-l-d 0 Sep 18 07:50 _backup_18-SEP-2007/ &#160; /cygdrive/c/temp $]]></description>
			<content:encoded><![CDATA[<p>
man: NAME: ls, ls &#8211; list directory contents<span id="more-61"></span>
</p>
<h6>Display only directories in current directory</h6>
<pre>
/cygdrive/c/temp $ ls -ld */
drwxr-xr-x+ 2 rz4tlj mkgroup-l-d 0 Sep 18 07:50 _backup_18-SEP-2007/
&nbsp;
/cygdrive/c/temp $ 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/ls.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mailx</title>
		<link>http://remidian.com/nix/os-commands/mailx.html</link>
		<comments>http://remidian.com/nix/os-commands/mailx.html#comments</comments>
		<pubDate>Fri, 24 Aug 2007 10:24:30 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>

		<guid isPermaLink="false">http://remidian.com/uncategorized/mailx.html</guid>
		<description><![CDATA[man: NAME: mailx, mail &#8211; interactive message processing system send file as attachment Use uuencode to encode a file and pipe it to mailx to be send as attachment (when you quickly need a file on your desktop it&#8217;s faster then ftp&#8230;) uuencode file to mailx $ uuencode file.txt file.txt &#124; mailx -s file.txt &#60;your-email-address&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>
man: NAME: mailx, mail &#8211; interactive message processing system<span id="more-55"></span>
</p>
<h3>send file as attachment</h3>
<p>
Use <code>uuencode</code> to encode a file and pipe it to mailx to be send as attachment (when you quickly need a file on your desktop it&#8217;s faster then ftp&#8230;)
</p>
<h6>uuencode file to mailx</h6>
<pre>
$ uuencode file.txt file.txt | mailx -s file.txt &lt;your-email-address&gt;
$ 
</pre>
<p>
In my environment the -r flag (return address) is needed since my mailserver is blocking mail without a known email address reply header.
</p>
<h6>uuencode file to mailx with -r flag</h6>
<pre>
$ uuencode file.txt file.txt | mailx -s file.txt -r &lt;your-email-address&gt; &lt;your-email-address&gt;
$ 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/mailx.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nohup</title>
		<link>http://remidian.com/nix/os-commands/nohup.html</link>
		<comments>http://remidian.com/nix/os-commands/nohup.html#comments</comments>
		<pubDate>Wed, 15 Aug 2007 07:45:59 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>

		<guid isPermaLink="false">http://remidian.com/nix/os-commands/nohup.html</guid>
		<description><![CDATA[man: NAME: nohup &#8211; run a command immune to hangups nohup and SQL*Plus Nohup and SQL*Plus can be easily used together: $ nohup sqlplus -s remi/remivisser @update.sql &#38; [4]&#160;&#160;&#160;&#160; 14433 $ Sending output to nohup.out &#160; $ $ Prevent password from being displayed in the ps list $ export password=remivisser $ nohup sqlplus -s remi/${password} [...]]]></description>
			<content:encoded><![CDATA[<p>
man: NAME:  nohup &#8211; run a command immune to hangups <span id="more-47"></span>
</p>
<h3>nohup and SQL*Plus</h3>
<p>
Nohup and SQL*Plus can be easily used together:
</p>
<pre>
$ nohup sqlplus -s remi/remivisser @update.sql &amp;
[4]&nbsp;&nbsp;&nbsp;&nbsp; 14433
$ Sending output to nohup.out
&nbsp;
$
$
</pre>
<h6>Prevent password from being displayed in the ps list</h6>
<pre>
$ export password=remivisser
$ nohup sqlplus -s remi/${password} @update.sql &amp;
[8]&nbsp;&nbsp;&nbsp;&nbsp; 16768
$ Sending output to nohup.out
$
$
&nbsp;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/nohup.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pipe</title>
		<link>http://remidian.com/nix/os-commands/pipe.html</link>
		<comments>http://remidian.com/nix/os-commands/pipe.html#comments</comments>
		<pubDate>Wed, 28 Mar 2007 15:02:28 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>

		<guid isPermaLink="false">http://remidian.com/uncategorized/export-import-using-pipe.html</guid>
		<description><![CDATA[man: NAME: pipe &#8211; create an interprocess channel import from compressed export file Example below demonstrates how to import &#8216;directly&#8217; from a compressed file. Handy when you have not enough space on your mountpoint to unpack the file. mknod pipe_db01 p &#160; zcat exp.dmp.Z &#62; pipe_db01 &#38; &#160; sleep 3 &#160; imp / file=pipe_db01 &#46;.. [...]]]></description>
			<content:encoded><![CDATA[<p>
man: NAME: pipe &#8211; create an interprocess channel <span id="more-39"></span>
</p>
<h3>import from compressed export file</h3>
<p>
Example below demonstrates how to import &#8216;directly&#8217; from a compressed file. Handy when you have not enough space on your mountpoint to unpack the file.
</p>
<pre>
mknod pipe_db01 p
&nbsp;
zcat exp.dmp.Z &gt; pipe_db01 &amp;
&nbsp;
sleep 3
&nbsp;
imp / file=pipe_db01 &#46;.. 
&nbsp;
</pre>
<p>
Same as above but now for the other compression utilities.
</p>
<h6>(win)zip</h6>
<pre>
unzip -p exp.dmp.zip &gt; pipe_db01 &amp;
</pre>
<h6>gzip</h6>
<pre>
gunzip &lt; exp.dmp.gz &gt; pipe_db01 &amp;
&nbsp;
gzip -cNf &lt; pipe_db01 &gt; exp.dmp.Z &amp;
gunzip -c exp.dmp.Z &gt; pipe_db01 &amp;
</pre>
<h6>cpio</h6>
<pre>
cpio -icvdu &lt; exp.dmp.cpio &gt; pipe_db01 &amp;
</pre>
<h3>The other way around</h3>
<p>
Export to pipe and compress.
</p>
<pre>
$ mknod c.pipe p
$ nohup compress &lt; c.pipe &gt; exp_DB01_2007-10-31.dmp.Z &amp; 
$ nohup exp system/$(cat .pwd) file=c.pipe owner=inotime log=exp_DB01_2007-10-31.log &amp; 
&nbsp;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/pipe.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>find</title>
		<link>http://remidian.com/nix/os-commands/find.html</link>
		<comments>http://remidian.com/nix/os-commands/find.html#comments</comments>
		<pubDate>Sun, 03 Sep 2006 19:24:35 +0000</pubDate>
		<dc:creator>remivisser</dc:creator>
				<category><![CDATA[os commands]]></category>

		<guid isPermaLink="false">http://remidian.com/uncategorized/find.html</guid>
		<description><![CDATA[man: NAME: find &#8211; find files Find/Remove old files Find files modified more then 365 days ago; find . -mtime +365 -exec ls -l {} \; Use touch to test $ touch -t 197801130300 oldfile $ find . -mtime +365 -exec rm {} \; $ ls oldfile ls: oldfile: No such file or directory]]></description>
			<content:encoded><![CDATA[<p>
man: NAME: find &#8211; find files <span id="more-20"></span>
</p>
<h3>Find/Remove old files</h3>
<p>
Find files modified more then 365 days ago;
</p>
<pre>
find . -mtime +365 -exec ls -l {} \;
</pre>
<p>
Use <code>touch</code> to test
</p>
<pre>
$ touch -t 197801130300 oldfile
$ find . -mtime +365 -exec rm {} \;
$ ls oldfile
ls: oldfile: No such file or directory
</pre>
]]></content:encoded>
			<wfw:commentRss>http://remidian.com/nix/os-commands/find.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
