<?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>logic involved &#187; shell</title> <atom:link href="http://www.coliena.com/blog/category/shell/feed/" rel="self" type="application/rss+xml" /><link>http://www.coliena.com/blog</link> <description>... more often than not ...</description> <lastBuildDate>Sat, 21 Jan 2012 18:09:36 +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>Free, Portable FTP Server for Windows</title><link>http://www.coliena.com/blog/2011/06/free-portable-ftp-server-for-windows/</link> <comments>http://www.coliena.com/blog/2011/06/free-portable-ftp-server-for-windows/#comments</comments> <pubDate>Thu, 23 Jun 2011 16:52:17 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[development]]></category> <category><![CDATA[shell]]></category> <category><![CDATA[free]]></category> <category><![CDATA[portable]]></category> <category><![CDATA[windows]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=515</guid> <description><![CDATA[If you are looking for a really simple, free and portable ftp server for Windows, then visit StahlWorks.com and get their excellent Swiss File Knife. It&#8217;s a single, small executable with no dependencies that brings a ton of features. If you have it, just run &#8230; sfk ftpserv -rw &#8230; and enjoy your zero-install, ultra-portable [...]]]></description> <content:encoded><![CDATA[<p>If you are looking for a really simple, free and portable ftp server for Windows, then visit StahlWorks.com and get their excellent <a
href="http://stahlworks.com/dev/swiss-file-knife.html">Swiss File Knife</a>. It&#8217;s a single, small executable with no dependencies that brings a ton of features. If you have it, just run &#8230;</p><p><code>sfk ftpserv -rw</code></p><p>&#8230; and enjoy your zero-install, ultra-portable ftp server!</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2011/06/free-portable-ftp-server-for-windows/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Piping text to the clipboard in Vista and Windows 7</title><link>http://www.coliena.com/blog/2010/05/piping-text-to-the-clipboard-in-vista-and-windows-7/</link> <comments>http://www.coliena.com/blog/2010/05/piping-text-to-the-clipboard-in-vista-and-windows-7/#comments</comments> <pubDate>Mon, 31 May 2010 12:39:24 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category> <category><![CDATA[command line]]></category> <category><![CDATA[windows]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=334</guid> <description><![CDATA[Microsoft added a new command line tool to Vista and Windows 7: clip.exe. This nifty little utility allows user to copy program output to the clipboard on the windows command line. Its usage is pretty straightforward: dir &#124; clip &#8211; copies the output of the dir command to the clipboard clip &#60; example.txt – copy [...]]]></description> <content:encoded><![CDATA[<p>Microsoft added a new command line tool to Vista and Windows 7: clip.exe. This nifty little utility allows user to copy program output to the clipboard on the windows command line. Its usage is pretty straightforward:</p><p><code>dir | clip</code> &#8211; copies the output of the <em>dir </em>command to the clipboard<br
/> <code>clip &lt; example.txt </code>– copy the contents of the file <em>example.txt</em> to the clipboard</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2010/05/piping-text-to-the-clipboard-in-vista-and-windows-7/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How To Restore A SQL Server Database via SQLCMD</title><link>http://www.coliena.com/blog/2009/11/how-to-restore-a-sql-server-database-via-sqlcmd/</link> <comments>http://www.coliena.com/blog/2009/11/how-to-restore-a-sql-server-database-via-sqlcmd/#comments</comments> <pubDate>Wed, 11 Nov 2009 16:07:07 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category> <category><![CDATA[sql]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=212</guid> <description><![CDATA[Run this with SQLCMD to restore a SQL Server database: RESTORE DATABASE MyDatabase FROM DISK = 'd:\backup\MyDatabase.bak' It&#8217;s that simple. Thanks to Michael Otey @ SQL Server Magazine.]]></description> <content:encoded><![CDATA[<p>Run this with SQLCMD to restore a SQL Server database:</p><p
style="padding-left: 30px;"><code>RESTORE DATABASE MyDatabase<br
/> FROM DISK = 'd:\backup\MyDatabase.bak'</code></p><p>It&#8217;s that simple.<br
/> Thanks to <a
href="http://www.sqlmag.com/Article/ArticleID/93186/sql_server_93186.html">Michael Otey @ SQL Server Magazine</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2009/11/how-to-restore-a-sql-server-database-via-sqlcmd/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to Create MD5 Checksums On Windows</title><link>http://www.coliena.com/blog/2009/10/create-md5-checksums-on-windows/</link> <comments>http://www.coliena.com/blog/2009/10/create-md5-checksums-on-windows/#comments</comments> <pubDate>Wed, 28 Oct 2009 15:13:09 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category> <category><![CDATA[checksum]]></category> <category><![CDATA[md5]]></category> <category><![CDATA[windows]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=203</guid> <description><![CDATA[There are many md5 utilities for Windows, but very few that  &#8230; are free/open source, create checksums for multiple files, export checksums to a file, and verify md5 sums from a list of files. In short: if you need a very good tool, then use the Swiss File Knife (sfk). For creating checksums for all [...]]]></description> <content:encoded><![CDATA[<p>There are many md5 utilities for Windows, but very few that  &#8230;</p><ul><li>are free/open source,</li><li>create checksums for multiple files,</li><li>export checksums to a file,</li><li>and verify md5 sums from a list of files.</li></ul><p>In short: if you need a very good tool, then use the <a
title="Swiss File Knife (sfk)" href="http://sourceforge.net/projects/swissfileknife/" target="_blank">Swiss File Knife (sfk)</a>.</p><p>For creating checksums for all your files in the current directory and storing the individual checksums in checksum.md5, execute this:</p><pre>sfk md5gento checksum.md5 .</pre><p>And for validating the checksums of all files in the current directory, execute this:</p><pre>sfk md5check checksum.md5</pre><p>That&#8217;s it <img
src='http://www.coliena.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2009/10/create-md5-checksums-on-windows/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Unix/Linux Command Overview</title><link>http://www.coliena.com/blog/2009/08/unixlinux-command-overview/</link> <comments>http://www.coliena.com/blog/2009/08/unixlinux-command-overview/#comments</comments> <pubDate>Wed, 19 Aug 2009 14:19:41 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[helpdesk]]></category> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=185</guid> <description><![CDATA[You are new to *nix and/or you need a concise overview of your new toys&#8217; command line tools? Then don&#8217;t miss the Unix Toolbox! Whether you are looking for a handy summary to carry around, or a help to get started quickly &#8211; this is what you are looking for.]]></description> <content:encoded><![CDATA[<p>You are new to *nix and/or you need a concise overview of your new toys&#8217; command line tools? Then don&#8217;t miss the <a
title="Unix Toolbox" href="http://cb.vu/unixtoolbox.xhtml" target="_blank">Unix Toolbox</a>!</p><p>Whether you are looking for a handy summary to carry around, or a help to get started quickly &#8211; this is what you are looking for.</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2009/08/unixlinux-command-overview/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Linux Bash Command Chaining</title><link>http://www.coliena.com/blog/2009/07/linux-bash-command-chaining/</link> <comments>http://www.coliena.com/blog/2009/07/linux-bash-command-chaining/#comments</comments> <pubDate>Thu, 09 Jul 2009 06:00:50 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=156</guid> <description><![CDATA[Zivo wrote a great post on the simple logic of chaining/ANDing/ORing Bash commands: *snip* Command Chaining: TO run a -&#62; b -&#62; c ls -lF /etc; pwd;who;ps Logical ANDing: Program b will execute only if program a was executed a&#38;&#38;b&#38;&#38;c Programs run mutually inclusive Returns a exit status 0 and then run b exit status [...]]]></description> <content:encoded><![CDATA[<p>Zivo wrote <a
href="http://blog.yucas.info/2008/08/21/bash-shell-command-chaining/">a great post</a> on the simple logic of chaining/ANDing/ORing Bash commands:</p><p>*snip*</p><p><strong>Command Chaining:<br
/> </strong><br
/> TO run a -&gt; b -&gt; c</p><p>ls -lF /etc; pwd;who;ps</p><p><strong><br
/> Logical ANDing:<br
/> </strong><br
/> Program b will execute only if program a was executed<br
/> a&amp;&amp;b&amp;&amp;c</p><p>Programs run mutually inclusive<br
/> Returns a exit status 0 and then run b exit status 0 and then run C</p><p>Logical ANDing &#8211; runs subsequent based on exit status of 0</p><p>ls -l /etc/resolv.conf &amp;&amp; grep name /etc/resolv.conf</p><p><strong><br
/> Logical ORing:<br
/> </strong><br
/> Run subsequent program based on failure of previous</p><p>ls -l /etc/resolve.conf || grep name /etc/resolv.conf</p><p>Example:</p><p>If the file text.txt doesnt exist you can create with ORing</p><p>ls -l test.txt || touch test.txt</p><p>Combining ANDing ORing<br
/> <code><br
/> -bash-3.00$ ls -l text.txt || touch test.txt &amp;&amp; ls -ltr test.txt<br
/> text.txt: No such file or directory<br
/> -rw-r--r--   1 carlosap other          0 Aug 22 00:13 test.txt<br
/> </code></p><p><strong><br
/> BASH for LOOPS<br
/> </strong></p><p>text.txt<br
/> 1<br
/> 2<br
/> 3<br
/> <strong><br
/> LOOPS SYNTAX:<br
/> for variable in list; do command variable; done<br
/> </strong><br
/> <code><br
/> -bash-3.00$ for i in `cat test.txt`; do echo $i; done<br
/> 1<br
/> 2<br
/> 3<br
/> -bash-3.00$ for i in `cat test.txt`; do echo test$i; done<br
/> test1<br
/> test2<br
/> test3</code></p><p>*snap*</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2009/07/linux-bash-command-chaining/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Recommended Putty Settings</title><link>http://www.coliena.com/blog/2009/05/recommended-putty-settings/</link> <comments>http://www.coliena.com/blog/2009/05/recommended-putty-settings/#comments</comments> <pubDate>Mon, 25 May 2009 20:26:58 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[helpdesk]]></category> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=138</guid> <description><![CDATA[I really like PuTTY &#8211; it might not be the perfect terminal emulator, but it does its job quite well. But sometimes you need to fumble around a bit to find the perfect settings for yet another server. However, I found these default settings with quite useful: Window -&#62; Appearance -&#62; Font: Courier New or [...]]]></description> <content:encoded><![CDATA[<p>I really like <a
title="PuTTY" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuTTY</a> &#8211; it might not be the perfect terminal emulator, but it does its job quite well. But sometimes you need to fumble around a bit to find the perfect settings for yet another server.</p><p>However, I found these default settings with quite useful:</p><blockquote><p>Window -&gt; Appearance -&gt; Font: Courier New or Lucida Console<br
/> Window -&gt; Translation -&gt; Character Set: UTF-8<br
/> Window -&gt;Translation -&gt; Line Drawing: Use Unicode Line drawing code points</p></blockquote> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2009/05/recommended-putty-settings/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Copy files over SSH</title><link>http://www.coliena.com/blog/2008/12/copy-files-over-ssh/</link> <comments>http://www.coliena.com/blog/2008/12/copy-files-over-ssh/#comments</comments> <pubDate>Sat, 13 Dec 2008 14:54:39 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=69</guid> <description><![CDATA[You have a SSH connection to a remote server, and you want to copy files back and forth but don&#8217;t know how? And you don&#8217;t want to fumble with scp? No Problem! There are quite a few file managers out there that allow you to work with remote file systems over SSH. My favourite is [...]]]></description> <content:encoded><![CDATA[<p>You have a SSH connection to a remote server, and you want to copy files back and forth but don&#8217;t know how? And you don&#8217;t want to fumble with<code> scp</code>?<br
/> No Problem!</p><p>There are quite a few file managers out there that allow you to work with remote file systems over SSH. My favourite is Midnight Commander, which is included in most Linux distributions out there. Just start it on your local machine (type <code>mc</code> in your terminal), select the menu &#8220;Left&#8221;, and click on &#8220;Shell link&#8230;&#8221;. Dialog will come up, enter your login details here, just as you would when using ssh (e.g. &#8220;<span
class="mh-email">user<a
href='http://www.google.com/recaptcha/mailhide/d?k=01Oa1q7gE9crjlPnvtvGON1A==&amp;c=MQtBL1CTPwWa2-vJm5Nnylzl0ZP304XMrI1XriIkgek=' onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k=01Oa1q7gE9crjlPnvtvGON1A==&amp;c=MQtBL1CTPwWa2-vJm5Nnylzl0ZP304XMrI1XriIkgek=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@example.com</span>&#8221;). You will be asked for your password, and voila &#8211; there you are!</p><p>Now you can browse the remote server on the left, and your local server on the right. Copying files back and forth should be no problem.</p><p>If you are looking for a better visual experience you might want to try <a
title="muCommander" href="http://www.mucommander.com/" target="_blank">muCommander</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2008/12/copy-files-over-ssh/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>vi basics</title><link>http://www.coliena.com/blog/2008/10/vi-basics/</link> <comments>http://www.coliena.com/blog/2008/10/vi-basics/#comments</comments> <pubDate>Thu, 30 Oct 2008 19:21:07 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[development]]></category> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=52</guid> <description><![CDATA[There are two competing editors in the *nix world: vi and Emacs. They look simple, but they are really mighty. And they have a reputation of being overly complex and unusable for non-nerds. Currently I am using vi most of the time, but that&#8217;s just because I am playing with equipment that is running BusyBox [...]]]></description> <content:encoded><![CDATA[<p>There are two competing editors in the *nix world: vi and Emacs. They look simple, but they are really mighty. And they have a reputation of being overly complex and unusable for non-nerds.</p><p>Currently I am using vi most of the time, but that&#8217;s just because I am playing with equipment that is running BusyBox now and then. I guess you are not surprised that I am telling you that using vi is not  very hard.</p><p>Enough chatting, let&#8217;s get our hands dirty!<br
/> There are hundreds of vi cheat sheets and tutorials out there.  But let&#8217;s keep this one simple <img
src='http://www.coliena.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p><span
id="more-52"></span></p><p>You might know that vi is all about modes. In other words, you can either view the text or edit it &#8211; no further magic.<br
/> These are the most basic commands you need to know when using vi:<br
/> <code>vi somefile.txt</code> &#8211; start vi and open the file somefile.txt<br
/> <code>i</code> &#8211; enter the edit mode (&#8220;Insert&#8221;)<br
/> <code>&lt;ESC&gt;</code> &#8211; pressing the escape key ends the editing mode and sends you back to read-only<br
/> <code>u</code> &#8211; revert your last changes (&#8220;Undo&#8221;)<br
/> <code>:w</code> &#8211; save the file (&#8220;Write&#8221;)<br
/> <code>:q</code> &#8211;  exit vi (&#8220;Quit&#8221;)</p><p>So you can open, edit and save files. This might not look like much, but these 5 basic commands are nearly all you need.</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2008/10/vi-basics/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Show open ports and process IDs in Solaris</title><link>http://www.coliena.com/blog/2008/10/show-open-ports-in-solaris/</link> <comments>http://www.coliena.com/blog/2008/10/show-open-ports-in-solaris/#comments</comments> <pubDate>Wed, 15 Oct 2008 19:43:54 +0000</pubDate> <dc:creator>niels</dc:creator> <category><![CDATA[shell]]></category><guid
isPermaLink="false">http://coliena.com/blog/?p=39</guid> <description><![CDATA[I needed a list of all open ports and their respective processes of a Solaris system one day. Unfortunately lsof was not available. After some searching I ran across this script (note that it requires ptree, so it runs on Solaris only &#8211; bad luck for you Linux/Mac/Cygwin guys): #!/usr/bin/ksh # # PCP (PID con [...]]]></description> <content:encoded><![CDATA[<p>I needed a list of all open ports and their respective processes of a Solaris system one day. Unfortunately <code>lsof</code> was not available. After some searching I ran across this script (note that it requires ptree, so it runs on Solaris only &#8211; bad luck for you Linux/Mac/Cygwin guys):</p><p><span
id="more-39"></span><br
/> <code><br
/> #!/usr/bin/ksh<br
/> #<br
/> # PCP (PID con Port)<br
/> # v1.07 20/05/2008 <span
class="mh-email">s<a
href='http://www.google.com/recaptcha/mailhide/d?k=01Oa1q7gE9crjlPnvtvGON1A==&amp;c=uEx4fybo1ZYrWX6Xi27Osg==' onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k=01Oa1q7gE9crjlPnvtvGON1A==&amp;c=uEx4fybo1ZYrWX6Xi27Osg==', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@unix.ms</span><br
/> #<br
/> # If you have a Solaris 8, 9 or 10 box and you can't<br
/> # install lsof, try this. It maps PIDS to ports and vice versa.<br
/> # It also shows you which peers are connected on which port.<br
/> # Wildcards are accepted for -p and -P options.<br
/> #<br
/> # The script borrows from Eric Steed's excellent "getport.sh" script.<br
/> #<br
/> #<br
/> if [ $# -lt 1 ]<br
/> then<br
/> echo >&#038;2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK)"<br
/> exit 1<br
/> fi<br
/> while getopts :p:P:a opt<br
/> do<br
/> case "${opt}" in<br
/> p ) port=${OPTARG};;<br
/> P ) pid=${OPTARG};;<br
/> a ) all=all;;<br
/> [?]) # unknown flag<br
/> echo >&#038;2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK) "<br
/> exit 1;;<br
/> esac<br
/> done<br
/> shift `expr $OPTIND - 1`<br
/> if [ $port ]<br
/> then<br
/> # Enter the port number, get the PID<br
/> #<br
/> port=${OPTARG}<br
/> echo "PID\tProcess Name and Port"<br
/> echo "_________________________________________________________"<br
/> for proc in `ptree -a | grep -v ptree | awk '{print $1};'`<br
/> do<br
/> result=`pfiles $proc 2> /dev/null| grep "port: $port"`<br
/> if [ ! -z "$result" ]<br
/> then<br
/> program=`ps -fo comm -p $proc | tail -1`<br
/> echo "$proc\t$program\t$port\n$result"<br
/> echo "_________________________________________________________"<br
/> fi<br
/> done<br
/> elif [ $pid ]<br
/> then<br
/> # Enter the PID, get the port<br
/> #<br
/> pid=$OPTARG<br
/> # Print out the information<br
/> echo "PID\tProcess Name and Port"<br
/> echo "_________________________________________________________"<br
/> for proc in `ptree -a | grep -v ptree | grep $pid| awk '{print $1};'`<br
/> do<br
/> result=`pfiles $proc 2> /dev/null| grep port:`<br
/> if [ ! -z "$result" ]<br
/> then<br
/> program=`ps -fo comm -p $pid | tail -1`<br
/> echo "$proc\t$program\n$result"<br
/> echo "_________________________________________________________"<br
/> fi<br
/> done<br
/> elif [ $all ]<br
/> then<br
/> # Show all PIDs, Ports and Peers<br
/> #<br
/> echo "PID\tProcess Name and Port"<br
/> echo "_________________________________________________________"<br
/> for pid in `ptree -a | grep -v ptree |sort -n | awk '{print $1};'`<br
/> do<br
/> out=`pfiles $pid 2>/dev/null| grep "port:"`<br
/> if [ ! -z "$out" ]<br
/> then<br
/> name=`ps -fo comm -p $pid | tail -1`<br
/> echo "$pid\t$name\n$out"<br
/> echo "_________________________________________________________"<br
/> fi<br
/> done<br
/> fi<br
/> exit 0<br
/> </code><br
/> Found at <a
href="http://www.unix.ms/pcp/">unix.ms</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.coliena.com/blog/2008/10/show-open-ports-in-solaris/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Served from: www.coliena.com @ 2012-02-06 01:08:22 by W3 Total Cache -->
