<?xml version="1.0" encoding="iso-8859-1"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
<?xml-stylesheet type="text/css" href="http://www.jerri.de/blog/"?>
<title type="html">Filed under: Konsole | Jerris Weblog</title>
<subtitle type="html">Alles was Jerri auf seiner Reise durch die Welt findet...</subtitle>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog" />
<link rel="self" type="application/atom+xml" href="http://www.jerri.de/blog/archives/konsole/index-atom.xml" />
<updated>2010-05-16T23:11:54+02:00</updated>
<author>
<name>Jerri</name>
<uri>http://www.jerri.de/blog</uri>
</author>
<id>http://www.jerri.de/blog/</id>
<generator uri="http://nanoblogger.sourceforge.net" version="3.4.2">NanoBlogger</generator>
<entry>
<title type="html">Reading through strace files - finding file accesses</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2010/02/06/reading_through_strace_files_-_finding_file_accesses/index.html" />
<id>http://www.jerri.de/blog/archives/2010/02/06/reading_through_strace_files_-_finding_file_accesses/index.html</id>
<published>2010-02-06T13:36:55+02:00</published>
<updated>2010-02-06T13:36:55+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>This is more or less a followup to my last blog entry. Still trying to find out about which application is using my hard drive. I experimented some more with strace and learned something about vim search patterns. :)</p>
<p>Suppose you make a strace of a process (e.g. 
<strike>
<tt>ls -l</tt>
</strike>
<tt>vim --help</tt>which outputs the standard vim commandline help) using the following command</p>
<pre>
strace -f -s 4095 vim --help 2&gt;$HOME/tracefile.txt
</pre>
<p>This creates a very large file with all system calls the process did during it's execution. To now find the file accesses in this tracefile you maybe would open this file in vim and then would naïvly search e.g. for the string 
<tt>] open (</tt>to see, which files where opened. Vim search hightlighting would show you all open statements, but you would have to read the file yourself to find the corresponding close statement. Works, but gets very strenously if there are a lot of open-calls.</p>
<p>Now, with the following search-pattern in vim (using search highlighting) you will find the whole block in the trace file; from the beginning open to the ending close-call wonderfully highlighted for a quick overview. (Enter this after pressing 
<tt>/</tt>in command-mode.)</p>
<pre>
] open(.* = \(\d*\)\_.\{-}] close(\1)
</pre>
<p>This pattern uses several new features I never really used before (Which is funny, as I tend to use regular expressions a lot). An example of the block this pattern finds is</p>
<pre>
] open("/usr/share/tcltk/tcl8.4/encoding/iso8859-1.enc", O_RDONLY|O_LARGEFILE) = 5
[pid 14780] fcntl64(5, F_SETFD, FD_CLOEXEC) = 0
[pid 14780] ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfb1bfa8) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 14780] read(5, "# Encoding file: iso8859-1, single-byte...", 4096) = 1094
[pid 14780] read(5, "", 4096)           = 0
[pid 14780] close(5)
</pre>
<p>
<b>EDIT:</b>As a reader remarked, my first example in this blog entry with 
<tt>ls -l</tt>is not very good. 
<tt>strace -f -s 4095 ls -l 2&gt;$HOME/tracefile.txt</tt>does not work with the given pattern, as no pid-information is output (it seems strace only outputs pid-information, if the process is multithreaded.). So without the pid-information, the pattern should look like this: 
<tt>^open(.* = \(\d*\)\_.\{-}] close(\1)</tt>. In this case only open and close calls on the main-thread are found. If you omit the first 
<tt>^</tt>in the pattern, the search should still work although it might get mixed up with the string 
<tt>open</tt>inside string-outputs from strace. In summary this blog entry was created way to fast without proper testing. Sorry for this. Hopefully the information in this entry still is of some use.</p>
<h3>backreferencing</h3>
<p>As you can see, the 
<tt>open</tt>call returns a handler id which is used to also 
<tt>close</tt>the access again. Therefore we use 
<tt>\(\d*\)</tt>to mark the first occurrence of the handler at the end of the line and backreference it at the end with 
<tt>\1</tt>. (Using 
<tt>\2</tt>, 
<tt>\3</tt>etc. you also could backreference more than one 
<tt>\(\)</tt>pattern.</p>
<h3>multi line search</h3>
<p>Normal you only search for patterns which can be found on one line. Here we have read over line endings. This is done by using 
<tt>\_.</tt>which is the same as 
<tt>.</tt>but also takes in account line endings.</p>
<h3>greedy search</h3>
<p>I you use the multiplier 
<tt>*</tt>to match more then one character, the longest string matching the atom will be found. For example with the string 
<tt>cabcabcabcab</tt>searching for 
<tt>c.*b</tt>will result in the full string found, as it starts with 
<tt>c</tt>and ends with 
<tt>b</tt>. If you only want to get 
<tt>cab</tt>you have to do a greedy search, which is done by using the multiplier 
<tt>\{-}</tt>. So doing 
<tt>c.\{-}b</tt>will result in finding only 
<tt>cab</tt>.</p>
<h3>addendum</h3>
<p>Be aware that this will not really work good, if the open and close statements are entangled. But it seems to work most of the time.</p>
<p>If you want to learn more about regular expressions in vim just enter 
<tt>:help regular-expression</tt>or 
<tt>:help pattern</tt>inside a vim-session.</p>
<p>Regular expressions can and should also be using in perl, javascript, sed, php, etc. They are very powerful constructs. Unfortunately every system seems to have its own dialect of regular expressions. But if you know the basic structure of regular expressions you learn to cope with the differences really fast.</p>
</div>
</content>
</entry>
<entry>
<title type="html">Inspect hard drive access under linux</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2010/01/31/inspect_hard_drive_access_under_linux/index.html" />
<id>http://www.jerri.de/blog/archives/2010/01/31/inspect_hard_drive_access_under_linux/index.html</id>
<published>2010-01-31T15:32:38+02:00</published>
<updated>2010-01-31T15:32:38+02:00</updated>
<category term="Interessant" />
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Ever wondered which application right now is writing to the hard drive. Currenlty trying to minimize the hard drive usage on my laptop and tried to answer this exact question.</p>
<p>Unfortunately I did not find a tool to exactly tell me which application is currently writing to which file on the harddrive. But a least with the tool 
<tt>iotop</tt>I was able to find out, which application is writing to the hard disc at all. Under ubunto or debian install this simply by invoking</p>
<pre>
apt-get install iotop
</pre>
<p>Like 
<tt>top</tt>this python-application continuously outputs the current processes which are using the hard drive. But you have to be very attentive to catch all applications while this tool is running. To get a better overview of all hard drive activity call the tool with the following parameters:</p>
<pre>
sudo iotop -qqqtaPob
</pre>
<p>This parameters put iotop into a mode where it outputs something like a logfile to the screen. Just let this run in the background, do something on your computer and then check, what tools where using the harddrive. Take a look in the man-pages of 
<tt>iotop</tt>to get the meaning of the parameters.</p>
<p>Now I am looking for a tool to really see to which files a running process currently is writing to. Some tests with 
<tt>strace -f -e trace=file -p PID</tt>where promising but failed if the running process opens the file only once at startup.</p>
<p>Anyone any ideas how to really see what and where a process writes something to the hard drive?</p>
</div>
</content>
</entry>
<entry>
<title type="html">Vim als IDE</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2009/12/18/vim_als_ide/index.html" />
<id>http://www.jerri.de/blog/archives/2009/12/18/vim_als_ide/index.html</id>
<published>2009-12-18T18:09:16+02:00</published>
<updated>2009-12-18T18:09:16+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Da ich gerade wieder sehr stark am PHP-Programmieren bin, war ich wieder etwas im Netz unterwegs um Tools und Tipps zur einfacheren Programmierung von tief verschachteltem OOP-PHP-Code zu finden. Dabei habe ich zwei sehr interessante Seiten gefunden.</p>
<p>Zunächst mal 
<a href="http://eclim.org/" target="_blank">Eclim</a>. Das ist ein Plugin sowohl für Vim als auch für Eclipse. Wer normalerweise mit Vim arbeitet, wird Eclipse als ein furchtbar langsames Ungetüm empfinden. Um einige der Funktionalitäten von Eclipse in Vim zu verwenden, aber dabei trotzdem schnell und flexibel zu arbeiten, der wird dieses Plugin mögen. Für Projekte mit tiefer Baumstruktur lohnt es sich definitiv. Auch die automatische Syntax-Pruefung bei Speicherung von php-Dateien ist sehr praktisch. Auch ich habe allerdings die ganze tiefe von Eclim noch nicht durchschaut. Dieses kleine Plugin ist sehr mächtig und der Programmierer Eric Van Dewoestine ist in seiner Mailingliste wahnsinnig schnell beim Beantworten von Fragen.</p>
<p>Ein kleiner Tipp von mir (selbst erst in der Mailing-Liste gelernt). Mit den folgenden beiden Einstellungen, sieht Vim schon beim Start in einem Eclipse-Projekt-Verzeichnis ein bisschen wie eine IDE aus. :)</p>
<pre>
" ProjectTree immer darstellen.
let g:EclimProjectTreeAutoOpen = 1
let g:EclimProjectTreeExpandPathOnOpen = 1
</pre>
<p>Die zweite 
<a href="http://www.koch.ro/blog/index.php?/archives/63-VIM-an-a-PHP-IDE.html" target="_blank">Seite</a>ist eine fantastische Fundgrube an Tools und Ideen für Vim, um hier wirklich IDE-Funktionalität zu erhalten. Vor allem der Tipp mit xdebug und dem Vim-Debugger-Plugin, ist genial. Nur ein bisschen Konfiguration und man kann bequem php-Applikationen debuggen. Und das beste dabei, unter Debian sind die meisten Sachen nur ein 
<tt>apt-get install</tt>weiter entfernt.</p>
<p>Das ganze mag einigen nicht neu vorkommen, aber ich war doch überrascht über die Möglichkeiten, die hier noch zu finden sind. Ich mag Vim einfach!</p>
<p>
<a href="http://eclim.org/" target="_blank">Welcome to Eclim - eclim (eclipse + vim)</a>
</p>
<p>
<a href="http://www.koch.ro/blog/index.php?/archives/63-VIM-an-a-PHP-IDE.html" target="_blank">VIM an a PHP IDE - Thomas Koch</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Problem with locales on remote server via ssh</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2009/12/04/problem_with_locales_on_remote_server_via_ssh/index.html" />
<id>http://www.jerri.de/blog/archives/2009/12/04/problem_with_locales_on_remote_server_via_ssh/index.html</id>
<published>2009-12-04T10:57:43+02:00</published>
<updated>2009-12-04T10:57:43+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>I recently had the problem, that I got the following error when I connection to a new debian-server via ssh and then called 
<tt>locale</tt>:</p>
<pre>
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=de_DE@euro
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
</pre>
<p>The same problem manifested in perl:</p>
<pre>
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_PAPER = "de_DE.UTF-8",
        LC_CTYPE = "de_DE@euro",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
</pre>
<p>First I thought it was a problem on the remote server. Googeling around I found a lot of users with the same problem, but not really a solution how to fix it correctly and what the problem is in the first place.</p>
<p>In the end some hints brought me to the solution: Debian in its default configuration allows ssh to set some environment-variables on the remote server. This is configured in 
<tt>/etc/ssh/ssh_config</tt>with the line 
<tt>SendEnv LANG LC_*</tt>. I think debian went this route to allow umlauts and other special chars to be possible in a ssh-session. Now, if the locale-setting on your local machine is not installed on the remote-system you get the aforementioned error-messages when you ssh to the remote server.</p>
<p>So, to get rid of this problem (which normally is only cosmetic) you have two possiblities:</p>
<ul>
<li>Don't send the environment locales from your locale machine to the remote machine. I took this way by just commenting out the line 
<tt>SendEnv LANG LC_*</tt>in 
<tt>/etc/ssh/ssh_config</tt>as I don't see any reason to set it on the remote system.</li>
<li>Or install the locale which you use on your local system on the remote system.</li>
</ul>
<p>I hope this helps some people coping with this problem and searching for an answer.</p>
</div>
</content>
</entry>
<entry>
<title type="html">Tutorial Videos zu VIM</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2009/10/03/tutorial_videos_zu_vim/index.html" />
<id>http://www.jerri.de/blog/archives/2009/10/03/tutorial_videos_zu_vim/index.html</id>
<published>2009-10-03T09:46:35+02:00</published>
<updated>2009-10-03T09:46:35+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Wieder mal nur ein kleiner Link, gefunden im weiten Netz, zum Thema , dem 
<a href="http://www.vim.org/" target="_blank">VIM</a>besten Editor der Welt. Derek Wyatt hat sich die Mühe gemacht, diverse Editierkonzepte in VIM in kleinen Videotutorials zu erklären. Sehr schön gemacht und auch ich habe wieder mal etwas gelernt. Man hört nie auf damit. Insbesondere für Anfänger sind diese Videos eine gute Hilfe, da auch einfachere Dinge in VIM erklärt werden. Alle Tutorials sind in englischer Sprache.</p>
<p>
<a href="http://vimeo.com/user1690209/videos" target="_blank">Derek Wyatt's videos on Vimeo</a>
</p>
<p>
<a href="http://www.vim.org/" target="_blank">welcome home : vim online</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Geniale Inspirationssammlung zum Scripting</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2009/08/05/geniale_inspirationssammlung_zum_scripting/index.html" />
<id>http://www.jerri.de/blog/archives/2009/08/05/geniale_inspirationssammlung_zum_scripting/index.html</id>
<published>2009-08-05T08:54:14+02:00</published>
<updated>2009-08-05T08:54:14+02:00</updated>
<category term="Interessant" />
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Eine kleine aber feine Seite, die ich erst vor kurzem gefunden habe. Hier ist gerade ein Wust an Inspiration versammelt, was das Scripting angeht. Wer viel und oft etwas auf der Console erledigt, sollte hier mal einen Blick drauf werfen. Vieles ist bestimmt bekannt, aber die eine oder andere Idee kann man abgreifen. :)</p>
<p>
<a href="http://www.commandlinefu.com/" target="_blank">commandlinefu.com</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Artikel über Remind...</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2006/08/20/artikel__uumlber_remind/index.html" />
<id>http://www.jerri.de/blog/archives/2006/08/20/artikel__uumlber_remind/index.html</id>
<published>2006-08-20T15:02:38+02:00</published>
<updated>2006-08-20T15:02:38+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Und wieder mal ein interessanter Artikel zu einem der Tools, die ich benutze. Diesmal erneut eine Einführung zu remind.</p>
<p>
<a href="http://www.linux.com/article.pl?sid=06/07/24/1516241" target="_blank">Linux.com - Manage your time with Remind</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Mal wieder eine interessante Seite zu vim...</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2006/08/19/mal_wieder_eine_interessante_seite_zu_vim/index.html" />
<id>http://www.jerri.de/blog/archives/2006/08/19/mal_wieder_eine_interessante_seite_zu_vim/index.html</id>
<published>2006-08-19T20:19:39+02:00</published>
<updated>2006-08-19T20:19:39+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Lange nicht mehr hier gepostet. Aber im Moment ist es Stressig. Sowohl in der Arbeit, als auch natürlich beim WoW-Spielen.</p>
<p>Beim Lesen der Vim-Mailing-Liste bin ich mal wieder auf eine interessante Seite gestoßen. Amir beschreibt hier seine vim-Umgebung und gibt Tips, wie man vim noch effizienter benutzen kann. Bestimmt nicht jedermanns Sache, aber denoch sehr viele interessante Ideen enthalten!</p>
<p>
<a href="http://amix.dk/blog/viewEntry/159" target="_blank">amix.dk : Workspace efficiency - Vim tip 1 of 3</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Verzeichnisse bookmarken mit cdargs...</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2006/07/10/verzeichnisse_bookmarken_mit_cdargs/index.html" />
<id>http://www.jerri.de/blog/archives/2006/07/10/verzeichnisse_bookmarken_mit_cdargs/index.html</id>
<published>2006-07-10T23:02:45+02:00</published>
<updated>2006-07-10T23:02:45+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Ich habe es übrigens tatsächlich gemacht. Ich habe mir World of Warcrafts gekauft und bin jetzt echter Held in dieser simulierten Welt. Ich fürchte, man merkt es an der Menge von Einträgen in meinem Blog. Aber keine Sorge. Ich werde versuchen dennoch bald wieder ein paar Einträge zu machen.</p>
<p>Meine letzte Entdeckung an der Konsole ist übrigens das Programm 
<a href="http://www.skamphausen.de/cgi-bin/ska/CDargs" target="_blank">cdargs</a>.</p>
<p>Unter Debian schnell als Paket zu installieren. Danach noch die folgende Zeile in die 
<tt>.bashrc</tt>eintragen:</p>
<pre>
source /usr/share/doc/cdargs/examples/cdargs-bash.sh
</pre>
<p>Dann neu einloggen, damit die 
<tt>.bashrc</tt>neu gelesen wird. Jetzt hat man diverse neue Befehle, mit denen man Verzeichnisse wechseln kann. Aber was ist daran so revolutionär? Verzeichnisse wechseln kann man auch mit 
<tt>cd</tt>!</p>
<p>Nun, der Witz ist, dass man nun Verzeichnisse sozusagen bookmarken kann. Wenn man also öfters mal in ein sehr tiefes Verzeichnis springen muss, dann kann man das folgende machen, um den Weg beim nächsten Mal wesentlich zu verkürzen.</p>
<pre>
# cd /wirklich/sehr/tiefe/verzeichnis/struktur
# mark einfachername
</pre>
<p>Das aktuelle Verzeichnis wurde jetzt mit dem Namen 
<tt>einfachername</tt>verbunden. Wenn man nun wieder in dieses Verzeichnis springen will, dann kann man das einfach, indem man das folgende an der Konsole eintippt:</p>
<pre>
# cv einfachername
</pre>
<p>
<tt>cv</tt>ist eine 
<tt>function</tt>, die cdargs aufruft, den Namen auflöst und in das entsprechende Verzeichnis springt. Sicher kann man diese Funktionalität auch mit symbolischen Links auf der Festplatte machen. cdargs erscheint mir aber aufgeräumter und einfacher.</p>
<p>Desweiteren unterstützt cdargs die Tab-Completion der Bash und man kann den Verzeichnisbaum auch über eine NCurses-Oberfläche erforschen.</p>
<p>
<a href="http://www.skamphausen.de/cgi-bin/ska/CDargs" target="_blank">Tellumar Kampiva: CDargs</a>
</p>
</div>
</content>
</entry>
<entry>
<title type="html">Jeden Tag ein neues Feature... :)</title>
<author>
<name>Jerri</name>
</author>
<link rel="alternate" type="text/html" href="http://www.jerri.de/blog/archives/2006/06/21/jeden_tag_ein_neues_feature/index.html" />
<id>http://www.jerri.de/blog/archives/2006/06/21/jeden_tag_ein_neues_feature/index.html</id>
<published>2006-06-21T10:29:33+02:00</published>
<updated>2006-06-21T10:29:33+02:00</updated>
<category term="Konsole" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Jetzt arbeite ich schon so lange mit 
<a href="http://www.vim.org/" target="_blank">vim</a>und finde doch immer wieder etwas neues, was ich noch nicht gewusst habe. Es handelt sich um den Befehl 
<tt>:Ex</tt>, den ich bisher noch nicht kannte. Auf diesen Befehl gebracht hat mit der folgende Artikel, den Nick Lo auf der vim-Mailinglist gepostet hat:</p>
<p>
<a href="http://www.ingredients.com.au/nick/2006/06/21/file-browsing-in-vim/" target="_blank">Ingredients » Nick's Notepad » Blog Archive » File browsing in Vim</a>
</p>
<p>Danke Nick! :)</p>
</div>
</content>
</entry>
</feed>
