Tag Archives: Linux

Gnome Terminal

Gnome terminal is probably one of the most unappreciated applications applications I use. Not a single day would go by where I don’t start an instance of Gnome Terminal. The same could also be said about Firefox except that I appreciate Firefox and recognise its usefulness. So here is the first of my posts on applications that I think deserve a much better appreciation.Gnome Terminal Icon

Gnome Terminal is a terminal emulator and it is the application I use 99% of the time to access the command line interface of my Linux PCs. The version I’m currently using comes with 2.26.2 and its version number matches that. Gnome Terminal can run my shells, SSH to another machine, start a terminal program or tail log files. The main reason that I use it so often would be because I prefer to use Gnome as my desktop environment.

I imagine that if I used KDE then this post would be about Konsole instead, if I used XFCE then it’d be Terminal and other environments have their own respective terminal emulators. Gnome terminal does your run of the mill terminal emulation just like any other terminal emulator but it also offers several other features.

My favourite feature has got to be transparency, without a compositing windows manager it looks pretty average but with one it give you true transparency. I don’t know exactly why, and I can only remember needing to look through terminals a couple of time, but I think that transparent terminals make me more productive. It certainly feels more productive (unlike wobbly windows, desktop on a cube and maximise and minimise animations).

So take a moment to appreciate your terminal, whether your using xterm, Gnome Terminal, Konsole, Terminal or aterm, chances are you use it many times a day. As one of the most used applications on my machine I know it is also one of the most unappreciated. It certainly deserves better, imagine what the impact of a bug (even small) would be. So here’s to Gnome Terminal, supporting my Linux hacking day in day out.

Random Thought: Is the worlds first infinite loop still going?

SystemTap

SystemTap is the Linux analogy to Solaris DTrace and is similar to the strace command, only much much more powerful. It effectively lets you set breakpoints in the kernel to monitor what your applications are doing. For example if I was worried that some application I’d written was polling way too often, I could ask SystemTap to output the number of times my application calls poll() or select().

To use SystemTap first you write a simple script, or borrow one from someone else. On a Fedora system you’ll fine some sample scripts in /usr/share/doc/systemtap-0.9.8/examples provided you have SystemTap installed. You then run the stap; command. The stap command immediately begins parsing the scipt looking for any tapsets that your script uses and if it does it includes them. It then converts your script into C code and compiles it into a kernel module. This kernel module is inserted into the running kernel and stap attaches to it. The kernel module stays in the kernel until it is cancelled by the user, it reaches an exit function or it encounters too many errors.

While SystemTap can be used to simply dump loads of data about what an application is doing in kernel space that is not its purpose. SystemTap scripts are able to drill down, extract, process and format the data its gathering. For example if you were trying to find out what files a process was writing to your disks could just output every single write call and print it out, or you could keep the statistics and every ten seconds print the top ten files written to. SystemTap is designed to help you filter out all the noise and monitor only what you want to monitor.

The simple way to get started with SystemTap is to download the Beginners guide or the Tutorial. On Fedora systems when you install SystemTap you’ll find the tutorial at /usr/share/doc/systemtap-0.9.8/tutorial.pdf. SystemTap skills are handy for system administrators and developers, so if you fit into those categories I’d highly recommend you check it out.

Random Thought: Where does /dev/zero come from and where does /dev/null go? What happens if you pipe /dev/zero to /dev/null?

The Truth Will Shock and Amaze You!

Pick the correct headline:

  • Meteorologists Determine That Hell Has Frozen Over
  • Scientists Genetically Engineer a Pig Capable of Flight
  • Microsoft Releases 20,000 Lines of GPL code to the Linux Kernel

if you know the subject matter of this blog, or read what category this post is in then you’ve most likely figured it out already. Its true, Microsoft today offered a total of 20,000 lines of code. The code, containing three device drivers related to virtualisation, has been submitted for inclusion into the kernel.

This is hard for some people to understand, indeed some Linux users are so entrenched in their hate of Microsoft that they are calling this as a bad thing. I don’t think people should be dismissing this so quickly. While Microsoft hasn’t been entirely friendly towards Linux in the past, this represent a substantial shift in their behaviour. Its things like this and the Community Promise that gives me hope of a world where Windows and Linux can coexist.

Random Thought: They say: “Linux is only free if your time is worthless.” and I say “Windows is only free if your money is worthless”

Edit (23/07/2009): Infoworld has a good writeup about Red Hat’s reaction to the news.

The Windows Registry vs Gconf

I often hear people attacking GNOME and Linux because of the claim that they’ve emulated the Windows Registry in Gconf. While this looks to be true at first glance, looking a bit deeper reveals many differences that make the two into completely separate entities. Both GConf and the Registry have their own advantages and drawbacks.

Windows Registry

The Windows Registry was added in Windows 95 to replace .INI files that Windows 3.1 applications would often use. These .INI files would be littered all over the filesystem in whatever location their application decided to put them. .INI files were easy to edit. Requiring only a text editor they could be edited in both DOS and Windows. The Registry was created to keep all the system settings in one place. Before it was released the APIs were made public so that any application could store its data along with all the system data in one common place.

This seemed like a great idea. No longer did you have to go searching to look for the settings for any particular application. Simply open up Registry Editor browse to your applications keys and edit away, unless you accidentally hit some system setting. Because system settings are stored right next to application settings changes to the Windows Registry could render the system unable to boot. This is why you see all those disclaimers on any tutorials involving the Windows Registry.

The Windows Registry is stored in a binary form. This makes it quick to load but limits its flexibility. After a Windows system fails to boot it will ask you if you want to boot with the last known good settings. This basically uses a backup of the Registry made at the last boot-up, where the settings are known to be correct. Not attempt to edit it can be made without a graphical environment and your only option is to roll back to a backup.

GNOME Gconf

On the surface Gconf appears to emulate the Windows Registry. Both gconf-editor and the Windows Registry Editor look very similar, and indeed operate in practically the same way. They’re both a collection of keys and values in a tree form. They also hold some similar settings such as keys to hold the desktop wallpaper location.

Gconf differs significantly to the Windows Registry though. You’ll notice that there are no settings in gconf to configure swapping, tune the filesystems, or configure routing. Gconf doesn’t hold any system settings, it stores only settings related to the desktop environment. You won’t find anything in there to help you configure device drivers or render your system unbootable.

The backing data store for Gconf in XML, which allows editing (though I’ll admit its somewhat difficult) with any text editor, command line or graphical. In the event of you making a change that stops your desktop environment from starting you’ll still be able to boot into a command line mode and attempt to fix the problem. It is also easier to identify when searching for it in a crashed filesystem.

Comparison

Both gconf and windows registry both represent their data in a tree based structure containing keys and values. This is where the similarities end. Gconf does not store system settings, editing it will not destroy your Linux machine. Gconf has a clearly defined scope, and is not meant to encompass every possible setting the computer may need. Gconf is easier to edit and repair, because of its XML format.

I refuse to debate which one is better because they are designed to perform some very different tasks. I do however think that the windows registry would benefit from an XML (or other text backend). Similarly Gconf could benefit from an automatic rollback/checkpointing mechanism.

Edit: Jeff Atwood (one of my favorite blog authors) recently wrote a post about the Windows Registry. Find it at http://www.codinghorror.com/blog/archives/000939.html.

Random Thought: Imagine for a second that transferring zeros over the internet was free and only the ones cost money. Now think of a compression algorithm (or an inflation mechanism rather) that increases the ratio of zeros to ones and makes data cheaper to transfer. Now imagine how you would perform error correction/detection with this protocol.

SSHmenu

This application I use almost as much as my terminal application. Also this application means that I now hardly ever type SSH any more. No more remembering my username on each host, remembering the options that host accepts and no more configuring each and every environment to update the xterm title to include the hostname.

At work  I have 109 hosts setup in my SSHmenu, this seems overwhelming but using menus and submenus i can hide away most of the clutter. I don’t ever have to remember the username I have on that host, any other hosts I have to go via on the way or even whether I can X forward from that machine. All that is abstracted away by a simple menu. SSHmenu will also set the title, size and colours of the terminal so you can ever have different colours for different hosts. Production hosts red, development blue and testing servers green for example.

The innate beauty of SSHmenu is that it is so easily hackable. On the SSHmenu website there is even a hacking guide. Normally it does SSH but there are instructions on how to add telnet support, and if you were savvy enough it would only be a small step to add rdesktop or dsh support.

If you manage or use more than 30 servers I’d highly recommend you check out SSHmenu. On Fedora its a simple ‘yum install gnome-applet-sshmenu‘.

See Also

http://embraceubuntu.com/2007/08/17/ssh-menu-save-and-open-ssh-connections-from-the-panel/

http://blog.flexion.org/index.php/2008/02/26/sshmenu-ssh-connection-management/

Random Thought: Why does my software that says Windows XP or better not work on Linux?