<?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>No Open Blockers &#187; Shell</title>
	<atom:link href="http://noopenblockers.com/category/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://noopenblockers.com</link>
	<description></description>
	<lastBuildDate>Fri, 06 Jan 2012 21:11:29 +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>Screen</title>
		<link>http://noopenblockers.com/2010/01/19/screen/</link>
		<comments>http://noopenblockers.com/2010/01/19/screen/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 13:48:05 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Fedora]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://noopenblockers.com/?p=862</guid>
		<description><![CDATA[I love when I find useful built-in commands that I never knew about. When starting out with Linux, I heard about the typical heavy hitters like grep, sed, and awk. Then I discovered some variations on common commands, such as htop and less. And then every so often, someone mentions a command in passing that [...]]]></description>
			<content:encoded><![CDATA[<p>I love when I find useful built-in commands that I never knew about. When starting out with Linux, I heard about the typical heavy hitters like grep, sed, and awk. Then I discovered some variations on common commands, such as htop and less. And then every so often, someone mentions a command in passing that causes me to say &#8220;Wait&#8230; what is that?&#8221;</p>
<p>Screen is one of those sorts of tools. I was watching a VNC demo of one of our team&#8217;s sprint reviews and was distracted by the fact that he had a tab bar on the bottom of a terminal. It turns out that was just part of the coolness of &#8220;screen&#8221;.</p>
<p>Screen is basically a window manager that runs in a terminal, letting multiple shells run within the single terminal. I&#8217;m sure there are other features that I&#8217;d find awesome, but there are two that immediately stood out.</p>
<p>As I mentioned, screen allows you to run multiple shells inside of a single terminal. Instead of starting up a handful of separate SSH sessions to a server, I now just use screen to manage multiple shells inside of a single connection. Each call to screen creates a new shell, with a simple emacs-like syntax to switch between them:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">ctrl + a + n    #  next
ctrl + a + p    #  previous
ctrl + a + 0    #  select screen 0</pre></div></div>

<p>One side note on this, by default the tab bar displaying the running shells isn&#8217;t displayed. Adding the following to <code>~/.screenrc</code> enables a visual indicator of the current and possible shells that are open:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">hardstatus on
hardstatus alwayslastline &quot;%{-b gk}%-w%{+b kg}%50&gt;%n %t%{-b gk}%+w%&lt; %= %{w}%D %M %d %C%a&quot;</pre></div></div>

<p align="center"><img src="http://noopenblockers.com/wp-content/uploads/2010/01/screen-shell.png" alt="" title="Screen" width="564" height="306" class="aligncenter size-full wp-image-864" /></p>
<p>While useful, it can still get a little confusing when a bunch of shells are opened. The title can be set by:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">ctrl + a  A</pre></div></div>

<p align="center"><img src="http://noopenblockers.com/wp-content/uploads/2010/01/screen2.png" alt="" title="Screen - Titles" width="564" height="306" class="aligncenter size-full wp-image-865" /></p>
<p>The second major piece of awesomeness is the ability to detach from a running screen and reattach later. Going back to the SSH example, this lets me leave some shells running, detach, completely disconnect from the server, and then reattach to the screen later (with everything left exactly as it was).</p>
<p>Again, an emacs-like syntax for detaching from a running screen:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">ctrl + a + d</pre></div></div>

<p>Later, to reattach to the running screen detached from earlier:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">screen -dr</pre></div></div>

<p>Like I said, I&#8217;m not trying to make this post sound like I&#8217;ve discovered some hidden black magic in Linux. It&#8217;s just an attempt to let new users know about this awesomeness.</p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2010/01/19/screen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Devil&#8217;s Pie</title>
		<link>http://noopenblockers.com/2009/12/09/devils-pie/</link>
		<comments>http://noopenblockers.com/2009/12/09/devils-pie/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 21:52:34 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Planet Fedora]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://noopenblockers.com/?p=810</guid>
		<description><![CDATA[I&#8217;ve been using Gnome for almost a year and a half now, and while I have grown to love a lot of the advantages it has, there are still some things I miss about FVWM. From a keyboard shortcut standpoint, many of them were alleviated when I discovered Gnome Do. However, I still found myself [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Gnome for almost a year and a half now, and while I have grown to love a lot of the advantages it has, there are still some things I miss about FVWM. From a keyboard shortcut standpoint, many of them were alleviated when I discovered <a href="http://do.davebsd.com/" target="new">Gnome Do</a>. However, I still found myself missing sticky, transparent shells that would give me a constant view into certain data, be it htop or tailing some files. It was really quick to set up in FVWM, but I had trouble finding a way to remove window decorations from windows in Gnome.</p>
<p align="center"><a href="http://noopenblockers.com/wp-content/uploads/2009/12/devilspie-full.png"><img src="http://noopenblockers.com/wp-content/uploads/2009/12/devilspie-thumb.png" alt="Devil&#039;s Pie + Gnome Terminal = Win" title="Devil&#039;s Pie + Gnome Terminal = Win" width="700" height="438" class="aligncenter size-full wp-image-828" /></a><em>Click for 1680&#215;1050 version</em></p>
<p>Sure, there are other ways to get the data I&#8217;m looking for, but having text rendered directly on the desktop like that just looks damn cool to me. It also intimidates the crap out of non-geeks when they see my office, which I fully admit is a big plus.</p>
<p>I came across a package called <a href="http://burtonini.com/blog/computers/devilspie/" target="new">Devil&#8217;s Pie</a> that gave me a lot more control over windows. Although I was looking for something that would let me actively select a window to give it certain properties (sticky, no decorations, etc), Devil&#8217;s Pie instead passively detects new windows and applies settings to them. It&#8217;s a mentality shift from my initial thoughts, but I think over time this model will actually be really useful. Plus, it has &#8220;pie&#8221; in the name, which is just awesome.</p>
<p>With a combination of gnome-terminal profiles/flags and Devil&#8217;s Pie configuration, I was able to get my desktop to automatically populate my desktop with all sorts of data. The following description of how is kinda wordy, but it&#8217;s really not complicated at all.</p>
<h2>Install and Configure Devil&#8217;s Pie</h2>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">sudo yum -y install devilspie
mkdir ~/.devilspie
touch ~/.devilspie/console.ds</pre></div></div>

<p>Devil&#8217;s Pie reads all configuration files (I believe they have to end in .ds, but don&#8217;t quote me on that) in the above directory on startup. Those files define the rules that will be applied to new windows that are created (there&#8217;s also a way to ask it to apply rules to all existing windows as well). For this example, I put my rules in a file named console.ds.</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">(if 
(contains (window_name) &quot;console&quot; )
(begin 
(undecorate)
(pin)
(skip_pager)
(skip_tasklist)
)
)</pre></div></div>

<p>There are two main parts to the above configuration. The first is the matching expression to decide if a window should have the rules applied. In this case, I indicate to apply the actions if the window name contains the string &#8220;console&#8221; (there are also options for &#8220;is&#8221; and &#8220;matches&#8221;). I&#8217;ll cover where that rule comes into play in a bit.</p>
<p>The actions do the following:</p>
<ul>
<li>undecorate &#8211; This is primarily what I was going for, I want the window decorations removed. This includes the title bar and border, though you can still use the shortcut key (alt+F8 by default) to resize a window without decorations.</li>
<li>pin &#8211; Make this window available on all workspaces. There are also attributes to control putting a window on a particular workspace, which could be useful in my case since I use 12 workspaces and am, well, pretty anal retentive about having certain applications in certain workspaces.</li>
<li>skip_pager &#8211; Don&#8217;t let the window show up in the pager. It removes the clutter in my pager since I don&#8217;t consider this a &#8220;real&#8221; application, just a status-type window.</li>
<li>skip_tasklist &#8211; A little more useful than skip_pager, this keeps the window off the taskbar, for the same rationale as above.</li>
</ul>
<p>Needless to say, I&#8217;m only scratching the surface of all of the actions supported. I haven&#8217;t found a good way to find this list yet; the man page says the -l flag will list symbols but when I try it, it just doesn&#8217;t do anything.</p>
<h2>Run Devil&#8217;s Pie</h2>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">devilspie</pre></div></div>

<p>Not much to say about that. I&#8217;ll talk more about enabling a debug mode later, but I mention it now to say it&#8217;s not done through flags. You&#8217;ll need to restart it every time you change your confguration files, but once you&#8217;re set add it to System -> Preferences -> Startup Applications and you&#8217;re good to go on reboots.</p>
<h2>Create Gnome Terminal Profile</h2>
<p>To summarize above, Devil&#8217;s Pie will take care of removing window decorations and keeping it on the visible workspace. We still need to configure Gnome terminal to add some slickness to how it looks. Since I don&#8217;t want this slickness on all of my terminals, I created a new profile named &#8220;console&#8221; with the following changes:</p>
<ul>
<li>Background &#8211; Transparent background, with the slider set all the way to none.</li>
<li>Scrolling &#8211; Scrollbar is: Disabled</li>
</ul>
<p>That gives us a completely transparent shell, reflective of its use to simply throw data at me.</p>
<h2>Start the Terminal</h2>
<p>Now we just need to make sure we start the terminal such that it will use the right profile and will trigger the window detection from Devil&#8217;s Pie. Here&#8217;s where the matching expression from above comes into play. I don&#8217;t want all of my terminals to have no decorations, just specific ones I want to treat in this fashion. When starting the terminal, tell it to use a specific window title that will match our Devil&#8217;s Pie rule from above.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">gnome-terminal -t console --profile=console --geometry=140x20+1680-0 -e htop</pre></div></div>

<p>A quick explanation of above:</p>
<ul>
<li>-t &#8211; Sets the title of the terminal window. This value should match up to the window_name value from the Devil&#8217;s Pie configuration.</li>
<li>&#8211;profile &#8211; Tells the terminal to use the slick console profile in all of its transparent goodness.</li>
<li>&#8211;geometry &#8211; Initially size and place the terminal on my screen.</li>
<li>-e &#8211; Run a specific command when it starts, in this case <code>htop</code>.</li>
</ul>
<hr/>
<p>My screenshot above simply uses a similar call to gnome-terminal, passing a tail command to -e and different geometry to get the log tail on the top of the screen.</p>
<p>Two other notes on Devil&#8217;s Pie:</p>
<p>There is a UI for editing the configuration files: <code>gdevilspie</code>. It&#8217;s handy because you can easily see the different types of matching expressions and actions, however the files it generated didn&#8217;t run for me. For some reason, even with one matching expression it still added a blank condition and an &#8220;and&#8221; statement and closed the conditions block too early. I haven&#8217;t looked to closely yet to see what is wrong.</p>
<p>Enabling debugging is as simple as adding another configuration file. I added one named &#8220;debug.ds&#8221; to my <code>~/.devilspie</code> directory that contained simply:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">(debug)</pre></div></div>

<p>Once that is in place, running the <code>devilspie</code> executable from the command line output some really useful window information whenever a new window was created.</p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/12/09/devils-pie/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Command Line Fu</title>
		<link>http://noopenblockers.com/2009/07/03/command-line-fu/</link>
		<comments>http://noopenblockers.com/2009/07/03/command-line-fu/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 20:56:13 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Fedora]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://noopenblockers.com/?p=684</guid>
		<description><![CDATA[This link seems to be being passed around the blogs, but I first saw it at pjp news. http://www.commandlinefu.com It&#8217;s a collection of user uploaded and ranked useful commands. The idea is similar to the two entries I wrote on shell tricks but on a much bigger and cooler level. Just quickly poking around the [...]]]></description>
			<content:encoded><![CDATA[<p>This link seems to be being passed around the blogs, but I first saw it at <a href="http://pjps.tumblr.com/post/134777861/command-line-fu" target="new">pjp news</a>.</p>
<p><a href="http://www.commandlinefu.com" target="new">http://www.commandlinefu.com</a></p>
<p>It&#8217;s a collection of user uploaded and ranked useful commands. The idea is similar to the <a href="/2008/11/05/shell-tricks/">two</a> <a href="/2009/03/29/shell-tricks-volume-2/">entries</a> I wrote on shell tricks but on a much bigger and cooler level. Just quickly poking around the first page of the site has already shown a number of things that are going to come in really handy. They also support all the usual useful channels like RSS and twitter, both of which you can use with a filtered threshold for user votes to limit the incoming commands to the truly awesome. There is some serious black magic to be learned on this site.</p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/07/03/command-line-fu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell Tricks &#8211; Volume 2</title>
		<link>http://noopenblockers.com/2009/03/29/shell-tricks-volume-2/</link>
		<comments>http://noopenblockers.com/2009/03/29/shell-tricks-volume-2/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 15:28:53 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=369</guid>
		<description><![CDATA[There is always new cool stuff to learn, especially when it comes to using a command line. It&#8217;s always been interesting to me to see scripts and random commands my coworkers use since there is inevitably some arcane yet handy command I never knew existed. A few months ago I posted Shell Tricks, a pretty [...]]]></description>
			<content:encoded><![CDATA[<p>There is always new cool stuff to learn, especially when it comes to using a command line. It&#8217;s always been interesting to me to see scripts and random commands my coworkers use since there is inevitably some arcane yet handy command I never knew existed.</p>
<p>A few months ago I posted <a href="/2008/11/05/shell-tricks/">Shell Tricks</a>, a pretty random set of short cuts and tricks I use on a regular basis from a shell. Pretty much immediately after finishing it I started this post as a way to keep a running track of things I picked up after the original post. I figured once the list got to a reasonable size I&#8217;d clean it up and post it.</p>
<ul>
<li>Change to the last directory &#8211; I forget where I picked this up, but I&#8217;ve been using it for as long as I can remember. To switch back to the previous directory you were in, run <code>cd -</code>. For example:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> code<span style="color: #000000; font-weight: bold;">/</span>rhn<span style="color: #000000; font-weight: bold;">/</span>spacewalk<span style="color: #000000; font-weight: bold;">/</span>
-<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>satellite<span style="color: #000000; font-weight: bold;">/</span>
-<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>jdob<span style="color: #000000; font-weight: bold;">/</span>code<span style="color: #000000; font-weight: bold;">/</span>rhn<span style="color: #000000; font-weight: bold;">/</span>satellite
-<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> -
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>jdob<span style="color: #000000; font-weight: bold;">/</span>code<span style="color: #000000; font-weight: bold;">/</span>rhn<span style="color: #000000; font-weight: bold;">/</span>spacewalk</pre></div></div>

<li>Insert the last argument &#8211; While I use the up and down arrows regularly to scroll through previously executed commands, sometimes I need to execute a new command on the same argument I previously used. Typing the escape key and then period will fill in the last argument from the previously executed statement.</li>
<li>This is less a shell trick and more of a &#8220;if you never knew this existed, it rocks and you want to install it.&#8221; My coworker Partha introduced me to rlwrap a few months ago. It came out of a frustration that sqlplus didn&#8217;t offer a way to use the up and down arrows to look through a history of SQL I&#8217;ve typed. That made it really annoying if I typed out a long ass statement only to find I made a typo early on. Now, if I run <code>rlwrap sqlplus</code> I get all of those nice user input features.
<p>I&#8217;m not sure how clear that is to the reader, so I&#8217;ve included a snippet from the rlwrap man page:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rlwrap runs the specified <span style="color: #7a0874; font-weight: bold;">command</span>, intercepting user input <span style="color: #000000; font-weight: bold;">in</span> order
to provide  readline’s line editing, persistent <span style="color: #7a0874; font-weight: bold;">history</span> and completion.</pre></div></div>

<li>Cowsay &#8211; Cowsay is an example of why geeks are pure awesome. When you run cowsay, you give it a string of text and it outputs ASCII art of a cow saying it. I&#8217;m not kidding. I know it&#8217;s available to both Fedora and Ubuntu distributions, and I&#8217;m sure many others offer it. For example:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> cowsay Geeks are awesome
 ___________________ 
<span style="color: #000000; font-weight: bold;">&lt;</span> Geeks are awesome <span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #660033;">-------------------</span> 
        \   ^__^
         \  <span style="color: #7a0874; font-weight: bold;">&#40;</span>oo<span style="color: #7a0874; font-weight: bold;">&#41;</span>\_______
            <span style="color: #7a0874; font-weight: bold;">&#40;</span>__<span style="color: #7a0874; font-weight: bold;">&#41;</span>\       <span style="color: #7a0874; font-weight: bold;">&#41;</span>\<span style="color: #000000; font-weight: bold;">/</span>\
                <span style="color: #000000; font-weight: bold;">||</span>----w <span style="color: #000000; font-weight: bold;">|</span>
                <span style="color: #000000; font-weight: bold;">||</span>     <span style="color: #000000; font-weight: bold;">||</span></pre></div></div>

<p>In case you were thinking it couldn&#8217;t get any more full of win than that, believe it or not it actually supports a pretty detailed series of arguments. For instance, <code>-d</code> renders the cow dead (look at the eyes):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> cowsay <span style="color: #660033;">-d</span> Dead cow
 __________ 
<span style="color: #000000; font-weight: bold;">&lt;</span> Dead cow <span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #660033;">----------</span> 
        \   ^__^
         \  <span style="color: #7a0874; font-weight: bold;">&#40;</span>xx<span style="color: #7a0874; font-weight: bold;">&#41;</span>\_______
            <span style="color: #7a0874; font-weight: bold;">&#40;</span>__<span style="color: #7a0874; font-weight: bold;">&#41;</span>\       <span style="color: #7a0874; font-weight: bold;">&#41;</span>\<span style="color: #000000; font-weight: bold;">/</span>\
             U  <span style="color: #000000; font-weight: bold;">||</span>----w <span style="color: #000000; font-weight: bold;">|</span>
                <span style="color: #000000; font-weight: bold;">||</span>     <span style="color: #000000; font-weight: bold;">||</span></pre></div></div>

<p>There are also options for tired cow, greedy cow, stoned cow (my favorite), and others.</p>
<p>It gets even better. There are other templates besides cows. For the Canadians:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> cowsay <span style="color: #660033;">-f</span> moose Moose
 _______ 
<span style="color: #000000; font-weight: bold;">&lt;</span> Moose <span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #660033;">-------</span> 
  \
   \   \_\_    _<span style="color: #000000; font-weight: bold;">/</span>_<span style="color: #000000; font-weight: bold;">/</span>
    \      \__<span style="color: #000000; font-weight: bold;">/</span>
           <span style="color: #7a0874; font-weight: bold;">&#40;</span>oo<span style="color: #7a0874; font-weight: bold;">&#41;</span>\_______
           <span style="color: #7a0874; font-weight: bold;">&#40;</span>__<span style="color: #7a0874; font-weight: bold;">&#41;</span>\       <span style="color: #7a0874; font-weight: bold;">&#41;</span>\<span style="color: #000000; font-weight: bold;">/</span>\
               <span style="color: #000000; font-weight: bold;">||</span>----w <span style="color: #000000; font-weight: bold;">|</span>
               <span style="color: #000000; font-weight: bold;">||</span>     <span style="color: #000000; font-weight: bold;">||</span></pre></div></div>

<p>A rather detailed dragon v. cow fight:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> cowsay <span style="color: #660033;">-f</span> dragon-and-cow Dragon and Cow
 ________________ 
<span style="color: #000000; font-weight: bold;">&lt;</span> Dragon and Cow <span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #660033;">----------------</span> 
                       \                    ^    <span style="color: #000000; font-weight: bold;">/</span>^
                        \                  <span style="color: #000000; font-weight: bold;">/</span> \  <span style="color: #000000; font-weight: bold;">//</span> \
                         \   <span style="color: #000000; font-weight: bold;">|</span>\___<span style="color: #000000; font-weight: bold;">/|</span>      <span style="color: #000000; font-weight: bold;">/</span>   \<span style="color: #000000; font-weight: bold;">//</span>  .\
                          \  <span style="color: #000000; font-weight: bold;">/</span>O  O  \__  <span style="color: #000000; font-weight: bold;">/</span>    <span style="color: #000000; font-weight: bold;">//</span>  <span style="color: #000000; font-weight: bold;">|</span> \ \           <span style="color: #000000; font-weight: bold;">*</span>----<span style="color: #000000; font-weight: bold;">*</span>
                            <span style="color: #000000; font-weight: bold;">/</span>     <span style="color: #000000; font-weight: bold;">/</span>  \<span style="color: #000000; font-weight: bold;">/</span>_<span style="color: #000000; font-weight: bold;">/</span>    <span style="color: #000000; font-weight: bold;">//</span>   <span style="color: #000000; font-weight: bold;">|</span>  \  \          \   <span style="color: #000000; font-weight: bold;">|</span>
                            <span style="color: #000000; font-weight: bold;">@</span>___<span style="color: #000000; font-weight: bold;">@`</span>    \<span style="color: #000000; font-weight: bold;">/</span>_   <span style="color: #000000; font-weight: bold;">//</span>    <span style="color: #000000; font-weight: bold;">|</span>   \   \         \<span style="color: #000000; font-weight: bold;">/</span>\ \
                           <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/|</span>       \<span style="color: #000000; font-weight: bold;">/</span>_ <span style="color: #000000; font-weight: bold;">//</span>     <span style="color: #000000; font-weight: bold;">|</span>    \    \         \  \
                       <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/|</span>        \<span style="color: #000000; font-weight: bold;">///</span>      <span style="color: #000000; font-weight: bold;">|</span>     \     \       <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
                    <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span>_<span style="color: #000000; font-weight: bold;">|</span>_ <span style="color: #000000; font-weight: bold;">/</span>   <span style="color: #7a0874; font-weight: bold;">&#40;</span>  <span style="color: #000000; font-weight: bold;">//</span>       <span style="color: #000000; font-weight: bold;">|</span>      \     _\     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">/</span>
                 <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/`/</span>,_ _ _<span style="color: #000000; font-weight: bold;">/</span>  <span style="color: #7a0874; font-weight: bold;">&#41;</span> ; -.    <span style="color: #000000; font-weight: bold;">|</span>    _ _\.-~       <span style="color: #000000; font-weight: bold;">/</span>   <span style="color: #000000; font-weight: bold;">/</span>
                             ,-<span style="color: #7a0874; font-weight: bold;">&#125;</span>        _      <span style="color: #000000; font-weight: bold;">*</span>-.<span style="color: #000000; font-weight: bold;">|</span>.-~-.           .~    ~
            \     \__<span style="color: #000000; font-weight: bold;">/</span>        <span style="color: #000000; font-weight: bold;">`/</span>\      <span style="color: #000000; font-weight: bold;">/</span>                 ~-. _ .-~      <span style="color: #000000; font-weight: bold;">/</span>
             \____<span style="color: #7a0874; font-weight: bold;">&#40;</span>oo<span style="color: #7a0874; font-weight: bold;">&#41;</span>           <span style="color: #000000; font-weight: bold;">*</span>.   <span style="color: #7a0874; font-weight: bold;">&#125;</span>            <span style="color: #7a0874; font-weight: bold;">&#123;</span>                   <span style="color: #000000; font-weight: bold;">/</span>
             <span style="color: #7a0874; font-weight: bold;">&#40;</span>    <span style="color: #7a0874; font-weight: bold;">&#40;</span>--<span style="color: #7a0874; font-weight: bold;">&#41;</span>          .----~-.\        \-<span style="color: #000000; font-weight: bold;">`</span>                 .~
             <span style="color: #000000; font-weight: bold;">//</span>__\\  \__ Ack<span style="color: #000000; font-weight: bold;">!</span>   <span style="color: #000000; font-weight: bold;">///</span>.----..<span style="color: #000000; font-weight: bold;">&lt;</span>        \             _ -~
            <span style="color: #000000; font-weight: bold;">//</span>    \\               <span style="color: #000000; font-weight: bold;">///</span>-._ _ _ _ _ _ _<span style="color: #7a0874; font-weight: bold;">&#123;</span>^ - - - - ~</pre></div></div>

<p>And of course a sheep.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-<span style="color: #000000; font-weight: bold;">&gt;</span> cowsay <span style="color: #660033;">-f</span> sheep Sheep
 _______ 
<span style="color: #000000; font-weight: bold;">&lt;</span> Sheep <span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #660033;">-------</span> 
  \
   \
       __     
      UooU\.<span style="color: #ff0000;">'@@@@@@`.
      \__/(@@@@@@@@@@)
           (@@@@@@@@)
           `YY~~~~YY'</span>
            <span style="color: #000000; font-weight: bold;">||</span>    <span style="color: #000000; font-weight: bold;">||</span></pre></div></div>

<p>I&#8217;ll stop there. Trust me, there are more. This is what happens when you let geeks have free time.</li>
<li>The <code>sl</code> command is arguably even cooler than cowsay. I can&#8217;t even fully do it justice in a blog entry, so I&#8217;ll leave it to the reader to install and see for yourself. My understanding is that it was meant as a way to mess with noobs who typed &#8220;sl&#8221; instead of &#8220;ls&#8221;. Not sure how legit that is, but I like the explanation. <img src='http://noopenblockers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/03/29/shell-tricks-volume-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell Tricks &#8211; Volume 1</title>
		<link>http://noopenblockers.com/2008/11/05/shell-tricks/</link>
		<comments>http://noopenblockers.com/2008/11/05/shell-tricks/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 23:12:21 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=160</guid>
		<description><![CDATA[I saw a post on Slashdot about &#8220;Stupid Unix Tricks&#8221; that talked about common things you take for granted in Unix or just flat out forget are there. With my RHCE exam coming up, it got me thinking about how many aliases and shell scripts I&#8217;ve written for myself that I use daily that won&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I saw <a href="http://rss.slashdot.org/~r/Slashdot/slashdot/~3/m-WQnPnmQUg/article.pl" target="new">a post on Slashdot</a> about &#8220;Stupid Unix Tricks&#8221; that talked about common things you take for granted in Unix or just flat out forget are there. With my RHCE exam coming up, it got me thinking about how many aliases and shell scripts I&#8217;ve written for myself that I use daily that won&#8217;t be there on the exam. Between those and my preference for emacs over vim, I need to reacquaint myself with a vanilla Red Hat Enterprise Linux installation so I&#8217;m not constantly stumbling over my habits on the exam.</p>
<p>Below are a list of either my favorites that I use constantly (some aren&#8217;t mind blowing but just a look into my habits) or ones from the Slashdot article that seemed particularly useful or cool.</p>
<ul>
<li>Colored ls &#8211; If your shell doesn&#8217;t include this by default, this alias will use color for all of your ls calls.</li>
<blockquote><pre>
alias ls='ls --color=auto'
</pre>
</blockquote>
<li><code>jardump</code> &#8211; For each JAR file found in the current directory or any child directories, output its contents to a file named <code>jardump.txt</code>. Very useful when using maven as it can be run in the maven repository directory to get a full listing of all classes in all JARs in the repository.</li>
<blockquote><pre>
find . -name '*.jar' -exec unzip -l {} \; > jardump.txt
</pre>
</blockquote>
<li>Change to a real directory from a symlink.</li>
<blockquote><pre>
cd `pwd -P`
</pre>
</blockquote>
<li>Commands can be executed on a remote machine through SSH without actually logging in. This is especially useful if you use key based login instead of passwords.</li>
<blockquote><pre>
ssh [user]@[server] [command]
</pre>
</blockquote>
<p>For example:</p>
<blockquote><pre>
ssh professorjay@novasurv.com ls /var/www
</pre>
</blockquote>
<li>Human readable listing of disk space.</li>
<blockquote><pre>
df -h
</pre>
</blockquote>
<li>List the contents of a zip file without actually unzipping it (tip: pipe it to less to scroll the contents if they are long).</li>
<blockquote><pre>
unzip -l [zip file]
</pre>
</blockquote>
<li>Extract a file in a zip to standard output rather than writing it to the disk, letting you read a file without unzipping the zip file. Again, you can pipe this to less to scroll the contents of the file.</li>
<blockquote><pre>
unzip -p [zip file] [full path to file in the zip]
</pre>
</blockquote>
<p>For example:</p>
<blockquote><pre>
unzip -p dom4j.jar META-INF/MANIFEST.MF | less
</pre>
</blockquote>
<li>A coworker introduced me to <code>tee</code>, which reads from standard input and writes to standard output and to a file. I use it when building so I can see the build messages in my shell like normal but also have a copy stored somewhere. The easiest way to explain it is with an example:</li>
<blockquote><pre>
make | tee /tmp/make-results.txt
</pre>
</blockquote>
<li>Add a new supplementary group to a user without having to respecify all of the user&#8217;s existing supplementary groups.</li>
<blockquote><pre>
usermod -aG [newgroup] [user]
</pre>
</blockquote>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2008/11/05/shell-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

