<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
  <title xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić's random unstructured stuff: Shell</title>
  <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/</id>
  <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?shell"/>
  <link xmlns="http://www.w3.org/2005/Atom" type="application/atom+xml" rel="self" href="https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443/feed/workspace/rot13?page=shell;type=Atom"/>
  <updated xmlns="http://www.w3.org/2005/Atom">2009-12-30T22:08:01Z</updated>
  <entry xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
    <title xmlns="http://www.w3.org/2005/Atom">Shell</title>
    <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?shell"/>
    <content xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml" type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml"><div>Creator: Dobrica Pavlinušić</div><hr/><div>Tags: howto, shell</div><hr/><div class="wiki">
<p>
Welcome to scratch pad of usefull shell snippets</p>
<div class="nlw_phrase"><table class="wafl_container">
  <tr>
    <td>
      <div class="wafl_box">
        
          <div class="wafl_titlebox">
            <div class="wafl_title">
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            </div>
          </div>
          <div class="wafl_items">
            
              <div class="wiki">
<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#remove_all_php4_packages_with_apt_get">Dobrica Pavlinušić's random unstructured stuff (remove all php4 packages with apt-get)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] remove all php4 packages with apt-=get} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#use_socat_as_simple_serial_program">Dobrica Pavlinušić's random unstructured stuff (use socat as simple serial program)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] use socat as simple serial program} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#list_first_ten_files_from_srchives">Dobrica Pavlinušić's random unstructured stuff (list first ten files from srchives)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] list first ten files from srchives} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#tail_recent_logs_and_put_output_in_file">Dobrica Pavlinušić's random unstructured stuff (tail recent logs and put output in file)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] tail recent logs and put output in file} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#port_forwarder_using_socat">Dobrica Pavlinušić's random unstructured stuff (port forwarder using socat)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] port forwarder using socat} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#remove_all_filesystem_cache">Dobrica Pavlinušić's random unstructured stuff (remove all filesystem cache)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] remove all filesystem cache} --></span></li>
</ul>
</div>

            
            
          </div>
        
      </div>
    </td>
  </tr>
</table>
<!-- wiki: {toc: }
--></div><br/><br/><h1 id="remove_all_php4_packages_with_apt_get">remove all php4 packages with apt-get</h1>
<pre>
dpkg -l | grep php4 | awk '{ print $2 }' | xargs apt-get remove -y
</pre>
<br/><h1 id="use_socat_as_simple_serial_program">use socat as simple serial program</h1>
<pre>
socat - /dev/ttyS0,b9600,echo=0,raw
</pre>
<br/><h1 id="list_first_ten_files_from_srchives">list first ten files from srchives</h1>
<pre>
ls *.tar.gz *.tgz | xargs -i sh -c "ls -hs '{}' ; echo ; tar tvfz '{}' | head -10 ; echo"

ls *.tar.bz2 *.tbz | xargs -i sh -c "ls -hs '{}' ; echo ; tar tvfj '{}' | head -10 ; echo"
</pre>
<br/><blockquote>
Yes, it sucks that <tt>tar</tt> doesn't know how to handle compression formats automatically...</blockquote>
<br/><h1 id="tail_recent_logs_and_put_output_in_file">tail recent logs and put output in file</h1>
<p>
Useful to take a quick view into last lines, reload page (and capture newly created errors/infos) and store that in single file for easy review (in vim :-)</p>
<pre>
tail -f /var/log/apache2/*.log | tee ~/log
</pre>
<br/><h1 id="port_forwarder_using_socat">port forwarder using socat</h1>
<pre>
socat -d -d TCP4-LISTEN:1280,fork TCP4:192.168.212.5:80
</pre>
<br/><h1 id="remove_all_filesystem_cache">remove all filesystem cache</h1>
<pre>
echo 3 &gt; /proc/sys/vm/drop_caches
</pre>
</div>
</div>
    </content>
    <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/index.cgi?shell</id>
    <author xmlns="http://www.w3.org/2005/Atom">
      <name xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić</name>
    </author>
    <updated xmlns="http://www.w3.org/2005/Atom">2009-12-30T22:08:01Z</updated>
    <category xmlns="http://www.w3.org/2005/Atom" term="howto" label="howto"/>
    <category xmlns="http://www.w3.org/2005/Atom" term="shell" label="shell"/>
  </entry>
</feed>
