<?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>Stefan Sobek Blog &#187; Bash</title>
	<atom:link href="http://www.sobek.info/blog/category/linux/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sobek.info/blog</link>
	<description>Writing about IT, Software Engineering, sports and other stuff</description>
	<lastBuildDate>Mon, 24 Jan 2011 12:50:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux, Unix, Mac &#8211; Loop filenames with spaces</title>
		<link>http://www.sobek.info/blog/2010/05/10/linux-unix-mac-loop-filenames-with-spaces/</link>
		<comments>http://www.sobek.info/blog/2010/05/10/linux-unix-mac-loop-filenames-with-spaces/#comments</comments>
		<pubDate>Mon, 10 May 2010 14:23:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[loop filenames]]></category>
		<category><![CDATA[shellscript]]></category>
		<category><![CDATA[spaces in linux filenames]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=272</guid>
		<description><![CDATA[Situation 
You want to operate on a linux, unix or mac system some files in a bash script and do some file operations like modifying the text content or moving the files to another location depending on the filename, content or another mathinc pattern. 
Problem 
Wondered why you have problems with windows files in a [...]]]></description>
			<content:encoded><![CDATA[<h5>Situation </h5>
<p>You want to operate on a linux, unix or mac system some files in a bash script and do some file operations like modifying the text content or moving the files to another location depending on the filename, content or another mathinc pattern. </p>
<h5>Problem </h5>
<p>Wondered why you have problems with windows files in a network when looping over them? Linux takes whitespaces in file name as line separator so that echoing the file will cause a separate line and so you cannot operate on this file. </p>
<h5>Solution </h5>
<p>I guess it is called <strong>Instruction Field Separator</strong> or something. You have to set this only to line break and not to whitespaces. First save the old variable content, then set the new content so that the bash do not takes whitespaces as line separators</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p272code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2722"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p272code2"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">OLDIFS</span>=<span style="color: #007800;">$IFS</span>
<span style="color: #007800;">IFS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\b&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> FILE <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.txt)
do
   echo $FILE
done
&nbsp;
$IFS = $OLDIFS</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2010/05/10/linux-unix-mac-loop-filenames-with-spaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Revert changes in svn</title>
		<link>http://www.sobek.info/blog/2010/03/25/revert-changes-in-svn/</link>
		<comments>http://www.sobek.info/blog/2010/03/25/revert-changes-in-svn/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 10:46:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[reverse change]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[undo merge]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=236</guid>
		<description><![CDATA[Sometimes you have to revert changes in svn from lets say a commit you made some days ago. Since then more commits where done and this can be a hard job to undo your changes. So how to undo the changes e.g. from your change in revision 120 when the actual revision is 140?
Go to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have to revert changes in svn from lets say a commit you made some days ago. Since then more commits where done and this can be a hard job to undo your changes. So how to undo the changes e.g. from your change in revision 120 when the actual revision is 140?</p>
<p>Go to your trunk workdir and use the following:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p236code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2365"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p236code5"><pre class="bash" style="font-family:monospace;">mvn merge <span style="color: #660033;">-r</span> <span style="color: #000000;">120</span>:<span style="color: #000000;">119</span> http:<span style="color: #000000; font-weight: bold;">//</span>my.svn.repo<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>

<p>The changes you made will be reverted. If there are some conflicts they will be shown.<br />
Maybe it is a good idea to make a dry run via:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p236code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2366"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p236code6"><pre class="bash" style="font-family:monospace;">mvn merge <span style="color: #660033;">--dry-run</span> <span style="color: #660033;">-r</span> <span style="color: #000000;">120</span>:<span style="color: #000000;">119</span> http:<span style="color: #000000; font-weight: bold;">//</span>my.svn.repo<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>

<p>So no changes are really made but only shows them.</p>
<p>Of course you can use this for reverting merges.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2010/03/25/revert-changes-in-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OCR under linux</title>
		<link>http://www.sobek.info/blog/2010/02/08/ocr-under-linux/</link>
		<comments>http://www.sobek.info/blog/2010/02/08/ocr-under-linux/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:04:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[ocr]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[tif]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=60</guid>
		<description><![CDATA[Imagine you have a pdf-file you want to make ocr-recognition. Take a scenario where you want to automatically let your linux pc do the job, e.g. in a folder. 
I choose tesseract-ocr as ocr-programm. Easy to install and use and ok for my use. Unfortunately it takes only tif as input file type so that [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine you have a pdf-file you want to make ocr-recognition. Take a scenario where you want to automatically let your linux pc do the job, e.g. in a folder. </p>
<p>I choose tesseract-ocr as ocr-programm. Easy to install and use and ok for my use. Unfortunately it takes only tif as input file type so that we have to convert the pdf to tif first.</p>
<p><strong>To create a tif file with Ghostscript  from pdf:</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p60code9'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p609"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p60code9"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gs</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-r300</span> <span style="color: #660033;">-dBATCH</span> <span style="color: #660033;">-dNOPAUSE</span> <span style="color: #660033;">-sDEVICE</span>=tiff24nc  <span style="color: #660033;">-sOutputFile</span>=Dokument2.tif Dokument1.pdf</pre></td></tr></table></div>

<p><strong><br />
Now start OCR-recognition with tesseract-ocr (maybe you have to install it). </strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p60code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6010"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p60code10"><pre class="bash" style="font-family:monospace;"> tesseract Dokument2.tif doc.txt <span style="color: #660033;">-l</span> deu</pre></td></tr></table></div>

<p>-l deu means &#8220;Deutsch&#8221; for German language recognition.<br />
-r300 means 300 DPI</p>
<p>Now it is easy to create a script which will automatically check a folder for new files and start ocr etc. </p>
<p>E.g. you can create a shell-script and start this shell script via cronjob. Maybe I will write an example here later. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2010/02/08/ocr-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a pdf from manpages</title>
		<link>http://www.sobek.info/blog/2010/01/16/create-a-pdf-from-manpages/</link>
		<comments>http://www.sobek.info/blog/2010/01/16/create-a-pdf-from-manpages/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 16:01:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=222</guid>
		<description><![CDATA[If you want to printout or save info from manpages simply type:

?View Code BASH1
man -t man &#124; ps2pdf - &#62; man.pdf

]]></description>
			<content:encoded><![CDATA[<p>If you want to printout or save info from manpages simply type:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p222code12'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p22212"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p222code12"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #660033;">-t</span> <span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ps2pdf</span> - <span style="color: #000000; font-weight: bold;">&gt;</span> man.pdf</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2010/01/16/create-a-pdf-from-manpages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download files with curl</title>
		<link>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/</link>
		<comments>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 13:31:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=205</guid>
		<description><![CDATA[If you want to download a file with curl type the following code into bash:

?View Code BASH1
curl -O http://www.url.de/file.html

-O means to output to a file and not to stdout, normally the screen.
What if you need to resume a download of a big file?

?View Code BASH1
curl -C - -O http://www.url.de/file.html

With -C &#8211; you continue downloading the [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to download a file with curl type the following code into bash:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code16'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20516"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code16"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>-O means to output to a file and not to stdout, normally the screen.</p>
<p>What if you need to resume a download of a big file?</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code17'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20517"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code17"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-C</span> - <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>With -C &#8211; you continue downloading the current file. If is important to write <strong>-C -</strong>. Don&#8217;t forget the -</p>
<p>You can also set a referrer and the user agent.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p205code18'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20518"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p205code18"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-C</span> - <span style="color: #660033;">-O</span> <span style="color: #660033;">-A</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6&quot;</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.url.de<span style="color: #000000; font-weight: bold;">/</span>file.html</pre></td></tr></table></div>

<p>With -A you can set the referrer and -e sets the user agent.</p>
<p>Pretty helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/20/download-files-with-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux kernel compilation syntax</title>
		<link>http://www.sobek.info/blog/2009/12/14/linux-kernel-compilation-syntax/</link>
		<comments>http://www.sobek.info/blog/2009/12/14/linux-kernel-compilation-syntax/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 15:45:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[kernel compilation]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=79</guid>
		<description><![CDATA[After unpacking the Kernel Archive to &#8220;/usr/src&#8221; use the following:

?View Code BASH1
2
3
4
make dep
make clean
make bzImagemake modules
make modules_install

]]></description>
			<content:encoded><![CDATA[<div>After unpacking the Kernel Archive to &#8220;/usr/src&#8221; use the following:</div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p79code20'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p7920"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p79code20"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> dep
<span style="color: #c20cb9; font-weight: bold;">make</span> clean
<span style="color: #c20cb9; font-weight: bold;">make</span> bzImagemake modules
<span style="color: #c20cb9; font-weight: bold;">make</span> modules_install</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/14/linux-kernel-compilation-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen command usage &#8211; part 2</title>
		<link>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/</link>
		<comments>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 08:57:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=66</guid>
		<description><![CDATA[To detach from an actual session press

?View Code BASH1
Ctrl+a d

Reattach with

?View Code BASH1
screen  -r

To list the actual detached sessions:

?View Code BASH1
screen  -list

You will see something like:

?View Code BASH1
2
4840.pts-3.localhost  &#40;Detached&#41;
4628.pts-1.localhost &#40;Detached&#41;

Reattach it with:

?View Code BASH1
screen  -r 4840.pts-3.localhost

To share a session with another user you have to ensure some steps.
Set the screen binary [...]]]></description>
			<content:encoded><![CDATA[<p>To detach from an actual session press</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code30'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6630"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code30"><pre class="bash" style="font-family:monospace;">Ctrl+a d</pre></td></tr></table></div>

<p>Reattach with</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code31'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6631"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code31"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-r</span></pre></td></tr></table></div>

<p>To list the actual detached sessions:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code32'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6632"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code32"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-list</span></pre></td></tr></table></div>

<p>You will see something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code33'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6633"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p66code33"><pre class="bash" style="font-family:monospace;">4840.pts-3.localhost  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Detached<span style="color: #7a0874; font-weight: bold;">&#41;</span>
4628.pts-1.localhost <span style="color: #7a0874; font-weight: bold;">&#40;</span>Detached<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Reattach it with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code34'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6634"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code34"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-r</span> 4840.pts-3.localhost</pre></td></tr></table></div>

<p>To share a session with another user you have to ensure some steps.</p>
<p>Set the screen binary setuid root:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code35'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6635"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code35"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span>  +s <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">screen</span></pre></td></tr></table></div>

<p>Login as root and start a screen session and name it:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code36'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6636"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code36"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-S</span> sessionName</pre></td></tr></table></div>

<p>Enable multi-user access function by pressing Ctrl+a then :multiuser on (to type &#8220;:&#8221;, press  &#8220;shift+;&#8221;)<br />
Grant permissions to the second user by pressing Ctrl+a: acladd  <em>username</em>, where username is the Unix user for the second user.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code37'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6637"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code37"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span>  <span style="color: #660033;">-x</span> root<span style="color: #000000; font-weight: bold;">/</span>sessionName</pre></td></tr></table></div>

<p>Activate logging with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p66code38'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6638"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p66code38"><pre class="bash" style="font-family:monospace;">Ctrl+a H</pre></td></tr></table></div>

<p>A file in your home directory will be created. Something like $HOME/screenlog.1</p>
<p>Type <em>exit </em>to exit screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/08/screen-command-usage-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send an E-Mail with Telnet via SMTP</title>
		<link>http://www.sobek.info/blog/2009/12/02/send-an-e-mail-with-telnet-via-smtp/</link>
		<comments>http://www.sobek.info/blog/2009/12/02/send-an-e-mail-with-telnet-via-smtp/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 10:52:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[send email]]></category>
		<category><![CDATA[send mail via telnet]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=68</guid>
		<description><![CDATA[How to send an email with telnet via smtp for testing purposes? Here is an example:

?View Code BASH1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
telnet  smtp.me.com 25
220 smtp.web.de ESMTP Web.de V4.91#2 Sun, 24 Nov 2009  16:51:20 +0100
&#160;
helo yourcomputername
250 smtp.web.de Hello yourcomputername &#91;219.99.999.999&#93;
&#160;
mail  from: account@web.de
250 account@web.de is syntactically  correct
&#160;
rcpt  to: empfaenger@provider.tld
250 empfaenger@provider.tld verified
&#160;
data
354 Enter message,  ending with [...]]]></description>
			<content:encoded><![CDATA[<p>How to send an email with telnet via smtp for testing purposes? Here is an example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p68code42'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6842"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p68code42"><pre class="bash" style="font-family:monospace;">telnet  smtp.me.com <span style="color: #000000;">25</span>
<span style="color: #000000;">220</span> smtp.web.de ESMTP Web.de V4.91<span style="color: #666666; font-style: italic;">#2 Sun, 24 Nov 2009  16:51:20 +0100</span>
&nbsp;
helo yourcomputername
250 smtp.web.de Hello yourcomputername <span style="color: #7a0874; font-weight: bold;">&#91;</span>219.99.999.999<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
mail  from: account<span style="color: #000000; font-weight: bold;">@</span>web.de
250 account<span style="color: #000000; font-weight: bold;">@</span>web.de is syntactically  correct
&nbsp;
rcpt  to: empfaenger<span style="color: #000000; font-weight: bold;">@</span>provider.tld
250 empfaenger<span style="color: #000000; font-weight: bold;">@</span>provider.tld verified
&nbsp;
data
354 Enter message,  ending with . on  a line by itself
To: anton<span style="color: #000000; font-weight: bold;">@</span>tirol.at;
From: hugo<span style="color: #000000; font-weight: bold;">@</span>schlaumeier.de
Subject: Jodelei 
&nbsp;
Servus<span style="color: #000000; font-weight: bold;">!</span>
&nbsp;
Greetz,
Peterli
.
250 OK  <span style="color: #c20cb9; font-weight: bold;">id</span>=18Z6Uc-0001wm-00
&nbsp;
Quit
<span style="color: #000000;">221</span> smtp.web.de closing connection</pre></td></tr></table></div>

<p>To send mail with auth:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p68code43'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6843"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code" id="p68code43"><pre class="bash" style="font-family:monospace;">telnet  smtp.me.com <span style="color: #000000;">25</span>
<span style="color: #000000;">220</span> smtp.web.de ESMTP Web.de V4.91<span style="color: #666666; font-style: italic;">#2 Sun, 24 Nov 2009  16:51:20 +0100</span>
&nbsp;
helo yourcomputername
250 smtp.web.de Hello yourcomputername <span style="color: #7a0874; font-weight: bold;">&#91;</span>219.99.999.999<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
auth <span style="color: #c20cb9; font-weight: bold;">login</span>
334 VXNlcm5hbWU6
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>base64 encoded username<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>repeated base64 encoded username<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>base64 encoded password<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>repeated base64 encoded password<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
235 Authentication successful
&nbsp;
mail  from: account<span style="color: #000000; font-weight: bold;">@</span>web.de
250 account<span style="color: #000000; font-weight: bold;">@</span>web.de is syntactically  correct
&nbsp;
rcpt  to: empfaenger<span style="color: #000000; font-weight: bold;">@</span>provider.tld
250 empfaenger<span style="color: #000000; font-weight: bold;">@</span>provider.tld verified
&nbsp;
data
354 Enter message,  ending with . on  a line by itself
&nbsp;
Subject: Jodelei 
&nbsp;
Servus<span style="color: #000000; font-weight: bold;">!</span>
&nbsp;
Greetz,
Peterli
.
250 OK  <span style="color: #c20cb9; font-weight: bold;">id</span>=18Z6Uc-0001wm-00
&nbsp;
Quit
<span style="color: #000000;">221</span> smtp.web.de closing connection</pre></td></tr></table></div>

<p>To base64 encode your username or pass, use another linux terminal and type:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p68code44'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6844"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p68code44"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">printf</span> username <span style="color: #000000; font-weight: bold;">|</span> base64
<span style="color: #7a0874; font-weight: bold;">printf</span> password <span style="color: #000000; font-weight: bold;">|</span> base64</pre></td></tr></table></div>

<p>If you don&#8217;t have base64 on your system try mimencode instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/02/send-an-e-mail-with-telnet-via-smtp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>scroll in screen</title>
		<link>http://www.sobek.info/blog/2009/12/02/scroll-in-screen/</link>
		<comments>http://www.sobek.info/blog/2009/12/02/scroll-in-screen/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 09:02:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[scroll]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=149</guid>
		<description><![CDATA[To scroll in screen-mode of linux type the following:
Strg+a then AltGr+8
Now you can scroll up and down. This is called the copy-mode. 
Source: http://blog.pregos.info/2009/02/26/scrollen-im-screen/
]]></description>
			<content:encoded><![CDATA[<p>To scroll in screen-mode of linux type the following:<br />
<strong>Strg+a then AltGr+8</strong></p>
<p>Now you can scroll up and down. This is called the copy-mode. </p>
<p>Source: <a href="http://blog.pregos.info/2009/02/26/scrollen-im-screen/">http://blog.pregos.info/2009/02/26/scrollen-im-screen/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/12/02/scroll-in-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful linux find commands</title>
		<link>http://www.sobek.info/blog/2009/11/30/useful-linux-find-commands/</link>
		<comments>http://www.sobek.info/blog/2009/11/30/useful-linux-find-commands/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 11:38:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sobek.info/blog/?p=58</guid>
		<description><![CDATA[Some useful linux find-commands:
Find files with file size between 10 and 20 MB 


?View Code BASH1
find -size +10M -size -20M


 
Find files not belonging to user root


?View Code BASH1
find ! -user root


Find files greater than 10 MB and list them with ls-lh.

?View Code BASH1
find -size +10M -exec ls -lh &#123;&#125; \;

Find files with .jpg ending [...]]]></description>
			<content:encoded><![CDATA[<div>Some useful linux find-commands:</div>
<div><strong>Find files with file size between 10 and 20 MB</strong><em> </em></div>
<div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code51'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5851"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code51"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-size</span> +10M <span style="color: #660033;">-size</span> <span style="color: #660033;">-20M</span></pre></td></tr></table></div>

</div>
<div><em> </em></div>
<div><strong>Find files not belonging to user root</strong></div>
<div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code52'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5852"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code52"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-user</span> root</pre></td></tr></table></div>

</div>
<div><strong>Find files greater than 10 MB and list them with ls-lh.</strong></div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code53'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5853"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code53"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-size</span> +10M <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></td></tr></table></div>

<div><strong>Find files with .jpg ending not case sensitive and create a tar-ball.</strong></div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code54'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5854"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code54"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">'*.jpg'</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-rf</span> bilder.tar <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></td></tr></table></div>

<div><strong>Find files with .mp3 ending not case sensitive and create a playlist.m3u file</strong></div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code55'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5855"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code55"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">'*.mp3'</span> <span style="color: #660033;">-fprint</span> playlist.m3u</pre></td></tr></table></div>

<p><strong>Find files with SUID bit set.<br />
</strong></p>
<p><span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code56'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p5856"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p58code56"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-perm</span> +6000 <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>  \; <span style="color: #000000; font-weight: bold;">&amp;</span>gt; suid.list</pre></td></tr></table></div>

<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sobek.info/blog/2009/11/30/useful-linux-find-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

