<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: term code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 20:05:22 GMT</pubDate>
    <description>DZone Snippets: term code</description>
    <item>
      <title>Populate titlebar in any term</title>
      <link>http://snippets.dzone.com/posts/show/4175</link>
      <description>Populate your titlebar in any term with some useful info such as uname -a, architecture, if you're ROOT or not, etc.  In Linux:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;HOST_NAME=`hostname -f`&lt;br /&gt;if [ `id -u` = 0 ]; then&lt;br /&gt;OPT=&#8221;`uname` (`uname -a | cut -f12 -d&#8217; &#8216; -`) - ROOT USER&#8221;&lt;br /&gt;else&lt;br /&gt;OPT=&#8221;`uname` (`uname -a | cut -f12 -d&#8217; &#8216; -`)&#8221;&lt;br /&gt;fi&lt;br /&gt;REPLACE=&#8221;${HOST_NAME} - ${OPT}&#8221;&lt;br /&gt;echo -n -e &#8220;\033]0; $REPLACE \007 &#8220;&lt;br /&gt;echo &#8220;${REPLACE}&#8221;&lt;br /&gt;exit 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Then run this script, and your termtitle will be something like the following:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Servername (Linux / x86_64).&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;For Solaris it needs to be done a bit differently:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/local/bin/bash&lt;br /&gt;HOST_NAME=`uname -a | cut -f2 -d&#8217; &#8216; -`&lt;br /&gt;OPT=&#8221;(`uname -a | cut -f1 -d&#8217; &#8216; -` / `uname -a | cut -f6 -d&#8217; &#8216;`)&#8221;&lt;br /&gt;REPLACE=&#8221;${HOST_NAME} - ${OPT}&#8221;&lt;br /&gt;echo -n -e &#8220;\033]0; $REPLACE \007 &#8220;&lt;br /&gt;echo &#8220;${REPLACE}&#8221;&lt;br /&gt;exit 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Add/remove things from the OPT= line to customize.  To test it, just issue the command on the commandline without the ()'s to see what it'll look like.</description>
      <pubDate>Wed, 20 Jun 2007 18:28:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4175</guid>
      <author>fak3r (fak3r)</author>
    </item>
    <item>
      <title>Linux - Escape Terminal</title>
      <link>http://snippets.dzone.com/posts/show/3073</link>
      <description>// Scrive sottolineato&lt;br /&gt;&lt;code&gt;&lt;br /&gt;echo -e "\033[4m\017Prova"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// Scrive in Blink&lt;br /&gt;&lt;code&gt;&lt;br /&gt;echo -e "\033[5m\017Prova"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 03 Dec 2006 23:32:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3073</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Watch a log and/or search for a certain term</title>
      <link>http://snippets.dzone.com/posts/show/2066</link>
      <description>If you're developing on a server that has all PHP errors turned off, you can still watch the error log (if you have access to this file). For example on a dreamhost account you could try this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tail -f /home/account/logs/website.com/http/error.log&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;As the errors pour in, you will see them come by. Change 'account' to the username you have on dreamhost and website.com to the domainname you host there. If the errors come in large amounts you can filter them by using grep:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tail -f /home/account/logs/website.com/http/error.log | grep -i "search_term"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now only errors containing 'search_term' will be shown.</description>
      <pubDate>Thu, 18 May 2006 00:29:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2066</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Find files with a certain extension, where the files contain a certain search term</title>
      <link>http://snippets.dzone.com/posts/show/2061</link>
      <description>Searches the current directory and deeper for files ending with the 'php' extension, where the file itself contains 'search_term'. Useful if you're searching a large website with lots of images and you only want to find a certain function or variable.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -name \*.php -exec grep -il "search_term" {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:15:34 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2061</guid>
      <author>yoghoyogho ()</author>
    </item>
  </channel>
</rss>
