Tag Archives: Software

tmux2

Tmux – Solving The Problem Of Window Names

I was lucky enough to get a book on using tmux for Christmas. Following through the examples I noticed that I was not getting the expected behaviour when attempting to set window names.

Commandline

1
$ tmux new-window -n console

What this should do is create a new tmux window and within it a window called "console". What I was getting was a tmux window containing a window named after my command prompt e.g. 'bob@computer ~'. This was bothering me so I set about researching the problem, unluckily for me its not one that is that common. By chance I located a post linking to a RedHat bug report https://bugzilla.redhat.com/show_bug.cgi?id=969429. The report outlines a problem regarding a change in terminal escape codes and highlighted an identical problem with screen as I am having with tmux. I checked the escape codes in my .bashrc file, nothing wrong there. Next stop was /etc/bashrc.

/etc/bashrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  if [ -z "$PROMPT_COMMAND" ]; then
    case $TERM in
    xterm*|vte*)
      if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
      elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
          PROMPT_COMMAND="__vte_prompt_command"
      else
          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
      fi
      ;;
    screen*)
      if [ -e /etc/sysconfig/bash-prompt-screen ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
      else
          PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
      fi
      ;;
    *)
      [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
      ;;
    esac
  fi

/etc/bashrc contained the above code section. It comprises two different sections for different terminals, each has its own prompt with different escape codes. The but report highlighted that the problem lay with the 033k escape code where as 033]0 worked. I should only be using the problematic escape code if I am using a screen terminal. So which am I using?

Commandprompt

1
$ echo $TERM

The result from running the above command in my gnome-terminal was "xterm-256color". This was expected and what I assumed I was using. Running it from inside a tmux session I got "screen-256color". Tmux using a screen terminal is pointing back to the problematic escape code. Time to go back to the .tmux.conf and check my settings.

.tmux.conf

1
2
# Use 256 term colours
set -g default-terminal "screen-256color"

There is my problem line, I have set it to use the screen terminal, oops.

.tmux.conf - Correct

1
2
# Use 256 term colours
set -g default-terminal "xterm-256color"

By using the xterm-256color terminal I correct the problem with the escape code. Rerunning my initial tmux command tmux opens with a window named 'console'. Problem solved.

System Email

On my Fedora system I collect the system emails to my user account. This results in a selection of daily emails outlining statuses which I am prompted to deal with whenever I launch a terminal. In the past I have used the "mail" command to read and delete the messages. It is not the easiest mail reader to deal with however. The fallback has been to use Evolution which is part of Gnome. I have never been a fan of Evolution, instead preferring Thunderbird. Thunderbird does not support the maildir format used by the system email and as such has been ruled out. I am going to be trying out Mutt, it is a command line reader that I found already installed on my system. The interface is structured unlike "mail" and even lists the shortcuts for commonly used commands. For my needs I don't need to configure Mutt to do anything. I did find a couple of links that may prove useful in making Mutt your primary email client.

http://www.gentoo.org/doc/en/guide-to-mutt.xml

http://mutt.blackfish.org.uk/

Keeping My Hat On

In my previous post I outlined my thinking about moving from Fedora to OpenSuse. I installed OpenSuse 12.3 onto mylaptop and had a play about. The installer was clean and easy to use and everything was setup with the minimum of effort.

Two issues with Fedora prompting a move were the control over the firewall and the Arduino software not being up to date. I was disappointed to that the installation of the Arduino software didn't come with a desktop icon setup but the latest version was there to use. Now onto the firewall; things were not good.

OpenSuse has completely removed the iptables scripts for managing the firewall. It seems you will use their firewall daemon and associated setup program. So basically the future looks like I will be being forced into using a wrapper of some sort around the iptables rules for my firewall. What's more, after doing some reading it would appear that more applications will rely on this dynamic functionality in the future. So what do I do? I can, on Fedora at least, use my existing script in the short term but need to migrate it. Alternatively I can change distro, waiting a little longer for the inevitable push towards dynamic firewalls.

Where does this leave me now then? I'm thinking of staying with Fedora at the moment. Fedora 19 will be due out in around 3-4 months time. At this point I think a clean installation of my main machine will probably be in order. In the mean time I can work on migrating my current firewall script over to the Firewalld system. It will mean I have to manually install the latest Arduino software but that is at least a manageable task.

OpenSuse was removed from the laptop and Fedora 18 reinstalled. A clean installation does appear to have changed a few things. A series of upgrades over the years had left a few legacy options it seems. The Fedora installer was not as user friendly as the OpenSuse installer, especially when it came to creating the dual boot with Windows on a separate hard disk. That said it did install and I'm sure it will improve in the future.

Going Gecko

Using Linux has always presented me with a lot of choice as to how I want to use it and how it can work for me. I started my Linux journey with Gentoo and stayed with it for many years. But over time I found it didn't fit with my workflow, it was fun to use and I learnt a lot but it required hands on tweaking.

I took the plunge and moved over to Fedora. Not having to compile software at install time or rebuild a lot of packages when a library changed was easier and has saved me time not having to go through packages that failed to compile. Fedora has been a stable system; well it is about a month after a big version update. Having a stable system has allowed me to use the system for actual work. But this stability has also brought a few problems. Stable packages are not always the newest. System packages this isn't a problem with as it's the solid foundation for everything else to run on. But the applications like Libre Office and in my case the Arduino IDE are not guaranteed to be up to date.

The Arduino IDE is in the Fedora repos, it is however 2 releases out of date. I have been trying to use it and have found myself struggling against a few bugs that I know to be fixed in a later version. Looking at the bug tracker for Fedora the version bump has been noted. If the package was in the testing repo allowing me to install the later version at my own risk I would be happy. But it isn't. The alternative option is for me to manually download and install the software. I have no objection to doing this, I often do it for software that is not in a repo. But it is irritating that a package that is in the repo is not keeping pace with upstream even as an unstable package.

The next irritation from Fedora is experimental improvements that make it into a release. Fedora 18 updated my machine with Firewalld, this is a daemon to run a dynamic firewall. This is all well and good but I had written my own firewall script and whilst I like some of the ideas that Firewalld brings I don't feel it should have been forced upon me. Firewalld is a Fedora project and reading up on it development is still ongoing and features being added. I am not happy about placing my faith in this package for security until it has matured. I am all for newer versions of existing packages but not radical changes like this. Fedora was also the first distro to use Gnome 3. The initial release was basic to say the least but it has improved over time. I get the feeling that it is possible to be too near the cutting edge for comfort.

So where does this leave me? Well one options is to go back to Gentoo. What is stopping me doing so at the moment is the changes going on in the background of several distros. Systemd is becoming the standard init system replacing a legacy system. Most distros have moved over to this as a default. The two which don't have this as a default are Gentoo and Debian. Gentoo does support it but this would require some tweaking which I was wanting to get away from. It also rules out Debian.

I had considered Arch Linux. Whilst it seemed to offer the flexibility of Gentoo without the compilation it was not without issues. Certain packages would install without all the dependencies, if I can't guarantee that then its another distro to avoid for a desktop. I'm not ruling out Arch for a very minimal server/netbook installation but for day to day desktop it's not for me.

Linux Mint is an option but it is based upon Debian. Whilst this is not a bad thing I prefer a distro to have it's own base and not be reliant on another distro. Ubuntu is a no go area, it has changed focus to be a testing ground for new ideas and I don't like the direction Canonical are taking it. Mageia has had more uncertainty over the years than I care to remember so it's out. Slackware is a no as its not a Gnome supporting distro. CentOS & Scientific Linux are based off RHEL & Fedora so they are out. So out of the big distros I am left with OpenSuse.

What is there to like about OpenSuse? Well on the face of it quite a bit. One thing that bugged me about Fedora was the fact it's forms were independent of the distro. Gentoo has an integrated community which I liked and OpenSuse seems to have the same. Trying to navigate the Fedora website was a pain. I found myself stumbling over project procedures and guidelines rather than the support and guides which I wanted to refer to. The OpenSuse website by contrast has a link to the forums on the main page and seems more navigable in general.

OpenSuse has better options for software, it makes it easy to search for software in various repos and select stable/unstable packages. The support from forms and wiki appear easy to access. Ultimately OpenSuse may not be as bleeding edge as Fedora but my current experiences suggest this isn't a bad thing. OpenSuse 12.3 is to be released in the next 24 hours. Time to give it a go.

Git Hub – Codecolorer

I have been using Git for version control on my own machine for a little while now. I've barely scratched the surface of what it can do but it is still useful to me. I have had an account on Git Hub for a while and have been meaning to either start or contribute to a project. I noticed that one of the syntax highlighting projects I use had not been updated in a while. So I forked the Codecolorer code and applied some updates. My intent is that these changes get pulled back into the main project. In the mean time my version of the codecolorer wordpress plugin is available here or by clicking on the link in the Git Hub widget (under Octocat).

Fixed: Fedora 16 Printing

During my upgrade from Fedora 15 to 16 several things broke, this is nothing new there were alot of major graphical components updated. Those issues were resolved in the week following the F16 release. What I had not expected to break was my network printing setup. In all the years I used Gentoo and upgraded over and over I never had many issues and when I did it was usually my fault.

This time nothing much was apparent aside from printing not working on either the host or client machines. First point of failure was the lack of a running CUPS service on each machine. Ok, so it was stopped during the upgrade and not restarted, annoying but not the end of the world. Still no joy. In the end I found I my previously set sharing settings had changed. With all the other changes in config files being highlighted allowing for manual updates this had slipped through the net. Sharing my printer again in the settings and bingo, everything works as before and auto detects. It has only taken a few minutes of fiddling around to fix but it has been finding those few minutes and being in the right mood to fix it. Hopefully the next upgrade will go a little more smoothly.

Fedora 15 – Initial Thoughts

I took the plunge a few days ago and updated my machines to Fedora 15. The results have been mixed. My netbook and laptop were the first to be upgrades with Intel and Nvidia graphics respectively. Both upgraded fine and the Gnome 3 experience was ok, if a little strange. The problems started with my server with an AMD/ATI graphics. The screen was tearing in places and the smooth experience I was getting on the netbook and laptop had been lost. I still have not fully resolved this problem and it proving difficult to use gnome 3 without it.

The one thing I am finding an issue with in Gnome 3 is the change in panel functionality. I previously minimised some applications like my RSS client to run as a minimised icon. Whilst there is a sort of similar function present I think apps need to be updated to take advantage of it.

Another problem presented itself in the form of a reboot leading to the a message saying the lan cable was unplugged. Rebooting again didn't solve the issue. I had to shut the machine down completely and cold boot before the network stated working again. At least one problem is solved. I will review again once a few more bugs are fixed.

Refactoring Email

I have been using email for many years now. Over that time I have changed between mail clients, addresses, operating systems and spam filters. Whilst I have been able to keep on top of filtering mail into folders it finally reached the point today where the the mess of filtering and folders needed a clean up.

First of all were the mailing lists and subscriptions which seemed a good idea at the time but never get read these days. Due to the traffic on these mailing lists I had them all automatically filtered into individual folders. I had folders in folders sometimes 3-4 levels deep. Unsubscribing means I can delete the levels of folders and the extensive filtering rules for them.

The next stage was to have a think about the marketing emails I get from the likes of Amazon, Screwfix etc. I still like to receive them as they sometimes contain offers I am interested in. For each of the stores that I had ordered from there was a sub-folder with the past ordering history. Order emails I sort by hand as they don't justify the need for their own filter. So the orders I want to keep but the general marketing is a read and discard affair. So why keep an individual folder for each marketing email? It makes it obvious where any new mail has come from but adds extra folders. So the decision was to group marketing mail into categories like 'Electronics Components'. All the marketing mail from related suppliers goes into a single folder. Any order emails can be moved by hand into an order folder for storage whenever they arrive. Suddenly a huge number of extra folders disappear.

The next stage was to rename and move the remaining folders into a more structured arrangement. The result is a more easily navigable tree of folders.

The final stage was to redefine and cleanup the mail filters. Having scrapped a lot of folders many rules were not needed. Others could now be grouped together to put mail in a single folder rather than many.

The result is that I now have a much cleaner and easier to use email experience. It took a few hours to get it how I wanted but it has been worth the effort. If nothing else, when I need to add another folder or filtering rule its going to be easier to do so. I have also removed the stuff I never read any more, its less stuff to deal with when checking email. It might be another year or two before I do something like this again, but a periodic review of the setup can only help to keep it clean an manageable.