Short Tip: Get file extension in Shell script

The command basename is often used to extract the real file name without the file type specific file extension:

$ basename thisfile.txt .txt

Now sometimes you need it the other way around, you might want to have the file extension. There are of course hundreds of ways to do so, but I found this one appealing since it also shows how the command awk works (which I should learn a bit better I think):

$ echo "thisfile.txt"|awk -F . '{print $NF}'

The “-F” marks the delimiter, “$NF” means the last field generated. Seems to be a pretty straightforward tool.
On a total unrelated note I really like the source code post style of WordPress.

Short Tip: Write to syslog

If you need to write something to syslog, Linux’ system logfile, you can do this by using logger:

logger Ready for xyz test

To check the result, run cat /var/log/messages:

Sep 17 17:14:48 localhost liquidat: Ready for xyz test

As you see the date, time and username are also included. In case you do this as root, the username will become logger.

Among the possible options of logger there are these two: -f will take a file as input instead of a message. The file content is parsed to the syslog entirely, so be easy on big files. The other one is -s: with that option the message will not only be posted to syslog but also to standard error.

Short Tip: Convert OGG screencasts to avi

In case you have an OGG video file for example from a screencast and want to convert it to a avi file for dailymotion or youtube all you have to do is:

mencoder video.ogg -ovc lavc -oac mp3lame -o video.avi

I am aware that there are better methods: you could specify more flags for probably better quality. But this is seldom necessary when you are about to host these videos on some online service.

KDE 4: cursor themes, LinuxMCE, some impressions

Current KDE 4 SVN has an improvement that makes it possible to change the cursor theme without re-starting X. Also, the LinuxMCE team now officially cooperates with KDE to merge technology where it makes sense. I also took some general KDE 4 screenshots to gather some impressions.

Cursor themes

One of the worst experiences I ever had when I showed an interested friend Linux for the first time was that changing the cursor theme (in KDE) made it necessary to restart X. This is something I didn’t forget :/

While I’m not sure how the situation is in Gnome (comments appreciated) this problem will be solved with KDE 4 as Commit Digest Issue 71 says:

Fredrik Höglund committed changes in /trunk/KDE/kdebase/workspace/kcontrol/input:
Make it possible to switch cursor themes without having to restart KDE.

Good to see that!

LinuxMCE and KDE 4

It was announced these days that LinuxMCE and KDE team up to improve the LinuxMCE UI and the general user experience. While LunuxMCE comes atm with its own full screen UI and therefore does not really need any specific kind of underlying desktop environment LinuxMCE already built upon KDE because:

in LinuxMCE 1.0, Ubuntu and LinuxMCE ran in separate X-sessions, so LinuxMCE could have its own desktop and window manager. However, you cannot have two X sessions both using hardware acceleration, therefore LinuxMCE forced Ubuntu to use Vesa mode, and the integration was messy. KDE, however, does allow use of XFWM, which supports compositing and all the other visual goodies, so now LinuxMCE runs entirely within the KDE desktop

For the future both teams now decided to team up for better cooperation. According to the announcement LinuxMCE’s interface will use Plasma in the future to make it easier to create new UI’s and also to integrate it seamlessly with the underlying KDE. If that works out the LinuxMCE developers will be able to concentrate on the UI design and the media center basics without the need to develop their own UI framework – the Plasma team could take care of it automatically by improving Plasma itself.

However, there will not be a KDE 4 integrated version of LinuxMCE before KDE 4.1 because at the moment there is mainly the announcement, and quite a lot of work has to be done until there is a Plasma integrated LinuxMCE.

Some impressions

After I rebuild the newest KDE SVN yesterday I took some screenshots to collect some impressions. Nothing changed that much over the last few weeks (most work is done now in Bug fixing) so these shots are nothing really new.

First of all the new Font installer already announced in Commit Digest Issue 69:

KDE 4 Font Installer preview

Second, there is an impression of the re-worked konsole with a configuration display. At the bottom you see the improved tab interface. The configuration dialog shows the colour choose. Interesting in this regard is that the konsole window switches to the new colour the moment you move your mouse over the new colour. The preview is fast and slick and a nice way to quickly see how the new colours will match (or not).

KDE 4 Konsole preview

The next screenshot shows the Phonon configuration window. On the left side you see the major audio task while the right side lists the interfaces. In that way a user can assign another interface for each task. This makes sure that you can use your headphone for your VoIP while the music play back on your sound card which is connected to your speakers. Quite useful especially if you have a headphone with integrated soundcard.

KDE 4 Phonon settings preview/p>

Last but not least one of the “new” user applications of KDE 4: Gwenview, the default image viewer of KDE 4. While the crop tool window is a bit strange (the floating window should be somewhere at the side, not in the middle, because most average users will not use it but the crop field in the picture itself. But besides that the interface is slick and nice.

KDE 4 Gwenview preview

In general KDE 4 looks nice – but there are still tons of bugs. Konqueror crashes, Dolphin is easily to crash, the Oxygen theme still seems to have quite some problems (check the file operations in the Gwenview shot), the systemsettings are far from complete, and so on. And of course the kicker replacement is not there yet (but I have no doubt that it will be there in time).
KDE 4 is on a very good way, and pretty far already – but it is simply not there yet, and Beta sometimes seems to be a bit too optimistic. But on the other hand it is just a question of time until it will be stable!