Thursday, November 22, 2012

Dealing with Vcard meeting requests in Mutt

Receiving Vcard Meeting requests that have been generated in Microsoft exchange or MS outlook
arrives in to your Mutt inbox, as an illegible mess of text that is difficult to make heads or tails out of

To configure your mutt to play nicely with Vcard meeting requests do the following.
First install the following (If they are not already installed)

yum install perl
yum install perl-devel
yum install perl-Data-ICal
yum install perl-Text-Autoformat

or use apt-get install if your distribution is Debian based

Then edit your .muttrc and add in the following lines

alternative_order text/calendar
This tells Mutt to display the text/calendar part in preference to the text/plain part.

color index black yellow "~b text/calendar"
this shows all meeting requests as black on yellow
change the colours to which ever you would prefer

The final step is to decode the vCalendar text into something that’s a bit more readable.

To do this we use the following perl script

click on the link then

you can copy and paste the text into your own local file

name the file vcal2text

and save it in /usr/local/bin

Give the script execute permissions

chmod +x /usr/local/bin/vcal2text

Start up Mutt and all Vcard meeting requests will be Legible

Monday, November 19, 2012

Printing with Mutt

By default, when you press the p key to print a message in mutt, you will not be prompted to choose a printer. Mutt will just print to the printer defined in your PRINTER environment variable.

To change the printer mutt uses , from within mutt, type in the following:

:set print_command="/usr/bin/lp.cups"
Make sure you type in the colon first. If you do not type in the colon first, the rest of what you type will be interpreted by mutt as  commands (for example, the 's' from the word 'set' will try to save the message).

To see what your current printer command is, type in:

:set print_command
If you are using Gnome 3 and you would like to use your Default cups printer from within mutt, you can set your printer command as follows:

:set print_command="/usr/bin/lp.cups"
To make this setting permanent

edit your .muttrc file and put

set print_command="/usr/bin/lp.cups"

at the end of the file  like so

vim .muttrc
and this time without the :

set print_command="/usr/bin/lp.cups"

Wednesday, July 11, 2012

Install Gnome 3.4 weather extention on Fedora 17

su - yum install gnome-common gtk3-devel glib2-devel intltool automake autoconf vala wget gnome-tweak-tool

unzip gnome3.4
mv simon04-gnome-shell-extension-weather-* weather
cd weather
./ --prefix=/usr
make install
Restart Gnome [Alt] + [F2] r
Click on top right hand corner of desktop, Then click on advanced settings (gnome-tweak-tool)
Click on
Shell Extensions and turn on the weather indicator extension.
Next you need to set your area, open up your web browser and goto this site
Enter your closest City to get your woeid eg my city is Valletta and the code is mtxx0001
In a non root terminal type the following to set your city
gsettings set woeid mtxx0001
Substituting mtxx0001 for your own cities woeid.
You can also change the name of your City by typing the following would change the city name to "Mosta" which is my actual village gsettings set city Mosta
To set the units to Fahrenheit or celcius, type one of the following.
gsettings set unit celsius
gsettings set unit fahrenheit
The position of the GNOME Shell extension in the panel can be configured to either 'left', 'center' or 'right' (requires restart of GNOME Shell). type one of the following
gsettings set position-in-panel center
gsettings set position-in-panel left
gsettings set position-in-panel right

Tuesday, June 26, 2012

rc.local on suse

Suse does not have rc.local enabled by default.

which means it is difficult to have a program automatically start up, after your system has been booted.

Suse does have a file called /etc/init.d/boot.local.

However it is not the same as rc.local
Inputting paths to files to run in the boot.local file
executes them before going to the first run level.
Which is a problem if you need your application to run after the system has completely booted.

rc.local to the rescue.

simply create your own rclocal file like so.
I use vim but you can use any file editor program like nano or gedit
vim /etc/rc.d/rclocal

then inside the file type the following (between the -----)
#! /bin/sh
## This script simulates redhat's rc.local (Add commands at the end)
# Provides: rclocal
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start: $ALL
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Simulates rc.local
# Description: Simulates redhat's rc.local: contains
# commands to execute after system has booted (all services are already
# available)
## Execute ony when service is started
case "$1" in
## commands will be executed
exit 0

#  Add your commands bellow this line

Save the file.
Make the file executable by typing the following: chmod +x rclocal
Create symlink to make it easy to find:  ln -s rclocal rc.local
Next, you need to enable the rc.local simulation in yast.
then scroll to
System > system services (Run Level)
then scroll down to
> rclocal   simulates rc.local
and enable it
 > Enable

Save your settings, and you are done.
you now have a rc.local that behaves exactly like the redhat/fedora  rc.local
You can add/remove commands to /etc/rc.d/rc.local anytime
by simply editing the rclocal file and adding your commands you wish to execute at the bottom of the file.

Tuesday, June 5, 2012

How to Upgrade from Fedora 16 to Fedora 17 (Beefy Miracle)

Insure that your system has more than 600MB of RAM, The upgrade requires this.(1GB or more is recommended)

First change to root user

su -

Upgrading To Fedora 17 (Desktop)
First upgrade your rpm package:

yum update rpm

Install the latest updates:

yum -y update

Clean the yum cache:

yum clean all

If a new kernel got installed during yum -y update, you should reboot the system


After the reboot, su back to root

su -

Install preupgrade...  (preupgrade will also take care of your RPMFusion packages)

yum install preupgrade

run preupgrade


The preupgrade wizard will then start on your desktop. Select Fedora 17 (Beefy Miracle). Your system will then prepare for the upgrade.

At the end, of the prepartion click on the Reboot Now button.
During the next boot make sure to catch the boot loader and select
Upgrade to Fedora 17 (Beefy Miracle).
During the reboot, your system will upgrade. This can take a  very long time, so please be patient.
(My system took about 4 hours)

That's it, Once Complete you can log into your new Fedora 17 (Beefy Miracle). system

To do the same on a Server that does not have X server (GUI) installed

Follow the same steps as above but run preupgrade with the following option


preupgrade will show you a list of releases that you can upgrade to. included in that list will be
Fedora 17 (Beefy Miracle) 

[root@server1 ~]# preupgrade-cli
Loaded plugins: blacklist, langpacks, whiteout
No plugin match for: rpm-warm-cache
No plugin match for: remove-with-leaves
No plugin match for: auto-update-debuginfo
Loaded plugins: langpacks, presto, refresh-packagekit
please give a release to try to pre-upgrade to
valid entries include:
   "Fedora 17 (Beefy Miracle)"
[root@server1 ~]#

To upgrade, append the release string to the preupgrade-cli command:

preupgrade-cli "Fedora 17 (Beefy Miracle)"

Preupgrade will also take care of your RPMFusion packages, so all you have to do after preupgrade has finished is to reboot:


catch the boot loader and select Upgrade to Fedora 17 (Beefy Miracle).

that's it, your Done.

Monday, May 21, 2012

Power off machine after process is complete

This will check your machine for a specified process.
As soon as that process stops running , your machine will power off.

This is useful for example if you are using wget to download a large website.
you can then tell your machine to power off as soon as the website is finished being downloaded ie when wget is finished.

 while pgrep wget || sudo shutdown -P now; do sleep 1m; done

substitute wget for the process that you want to monitor.

Friday, May 18, 2012

Joining Linux server/workstation to Windows Active Directory

This  joins your Linux machine to a Windows Active Directory domain
and allows you to share your samba shares to users of the Active Directory domain without further authentication.

You need to install the latest version of Samba which is currently version 3
also  install samba-common, samba-client  and samba-winbind

yum install samba samba-client samba-common samba-winbind

if not already installed you also need to have
ntpd, and kerebos installed

yum install ntpd  kerberos

it is imperative that your linux machines clock is in sync with the active directory domain controller

ntpdate -u  [ip of your ADserver]

ntpdate -u

next make sure that ntpd winbind and samba all start on boot up and are all running

chkconfig ntpd on
chkconfig winbind on
chkconfig smb on
/etc/init.d/ntpd start
/etc/init.d/smb start
/etc/init.d/winbind start

next edit your samba config file

vim /etc/samba/smb.conf

and change the following settings so that they are as they appear here.
Substitute CLIVE.COM with your Active directory domain name.
Also insure that you do not have a netbios entry.
If you have a line in your samba config file that says
netbios name = somename

delete the above line (if it exists)

the netbios entry will be added automatically by the system when you join the domain later.

your smb.conf should look something like this

 workgroup = CLIVE
        realm = CLIVE.COM
        preferred master = no
        server string = Samba File Server

 security = ADS
        encrypt passwords = yes
        log level = 3
        log file = /var/log/samba/%m
        max log size = 50
        winbind enum users = Yes
        winbind enum groups = Yes
        winbind use default domain = Yes
        winbind nested groups = Yes
        winbind separator = +
        idmap uid = 600-20000
        idmap gid = 600-20000
        hosts allow = (put the ip of your network here)
        hosts deny =

Restart samba to load in the new config.

/etc/init.d/smb restart 

next you need to edit your kerberos config file

vim /etc/krb5.conf
and make the following additions
change CLIVE.COM for your AD domain name
and change servername to your active Directory domain controllers machine name.

case sensitivity is of extreme importance here.
  kdc =
  admin_server =
  default_domain =

 .kerberos.server = CLIVE.COM = CLIVE.COM = CLIVE.COM

save the file

and then run the following file to make sure everything is working as it should.

 /usr/kerberos/bin/kinit administrator@CLIVE.COM

You should be asked for the domain administrators password, once put in correctly you will return to a command prompt.

(Please note if you get an error here it is more than likely because your clock on your linux machine is not synced to your active directory domain controller)  check your clock and use ntpd to sync it properly.

next edit your nsswitch.conf file and change it so that it looks like this
vim /etc/nsswitch.conf

passwd:     compat winbind
shadow:     compat
group:      compat winbind

save the file and restart winbind
/etc/init.d/winbind restart

Edit your /etc/hosts file

vim /etc/hosts 

and insure you have the following line hostname
remove localhost localdomain from the entry

save /etc/hosts

 And now lets join your machine to the domain.
net ads join -U Administrator@CLIVE.COM

put in the administrators password and if all goes well your machine will be added to the domain
next type
wbinfo -u

to show a list of all the users of the Active directory domain.

in Samba to give access to an active directory user to your samba share,
edit the valid users line in your smb.conf file and add your active directory users like so,
substitute CLIVE for your domain name

        comment = share
        path = "/home/samba/shares/share/"
        browseable = yes
        writable = yes
        read only = no
        create mode = 0777
        directory mode = 2777
        valid users = CLIVE+administrator CLIVE+cliveg CLIVE+user2

to add an entire group ie Domain Users use the @
valid users = "@CLIVE+Domain_users" 

don't forget to restart Samba every time you make changes to smb.conf.

Friday, March 30, 2012

Find 20 Largest Files on your system

Running out of Disk Space ?
want to see which files are the largest files on your system and are contributing to filling up your hard disk.
Copy and paste the following command into your terminal. and run it in your root directory.

find . -type f -print0 | xargs -0 du -h | sort -hr | head -20

This will  list the 20 Largest files on your System, and report their size in human readable format.

better still, copy and paste the line into a file,
name the file bigfiles
save the file in /usr/local/bin
chmod +x /usr/local/bin/bigfiles
then from anywhere on your system simply type 

Saturday, March 24, 2012

Pimp your Tail command

The default settings of the TAIL command is to output the last 10 lines of a file

tail /var/log messages

will output the last 10 lines of your /var/log/messages file

Mar 24 11:25:20 mirage dbus-daemon[1094]: dbus[1094]
Mar 24 11:25:20 mirage dbus[1094]: [system] Successfully activated service 'org.freedesktop
Mar 24 11:27:44 mirage dbus-daemon[1094]: dbus[1094]: [system] Activating service name
Mar 24 11:27:44 mirage dbus[1094]: [system] Activating service name='net.reactivated
Mar 24 11:27:44 mirage dbus-daemon[1094]: Launching FprintObject
Mar 24 11:27:44 mirage dbus[1094]: [system] Successfully activated service 'net.reactivated.Fprint'
Mar 24 11:27:44 mirage dbus-daemon[1094]: dbus[1094]: [system] 
Mar 24 11:27:44 mirage dbus-daemon[1094]:
Mar 24 11:27:44 mirage dbus-daemon[1094]: ** Message: entering main loop

This alias changes the default setting of tail so that it outputs all the lines that can fit on your screen.

just add the following to your .bashrc if you use bash or your .zshrc if you use zsh as your terminal editor.

alias tail='tail -n $((${LINES:-`tput lines 2>/dev/null||echo -n 80`} - 7))'

then source youre .bashrc or .zshrc by typing
source .bashrc or
source .zshrc

or just restart your terminal

next time you run  tail on a file you will get as many lines as will fill up your screen.

Sunday, March 18, 2012

play and edit MT2S files

MT2S files are High Definition Sony Blue ray AVCHD Files,
commonly produced by High Definition Camcorders.

To use edit and play these files on your Linux system
Openshot video editor works well as a video editor

yum install openshot or apt-get install openshot

although VLC can play these files you need to make the following changes to VLC so that they play well.

open up VLC

Go to Tools -->Preferences --> Input &  Codecs 
on the option “Skip the loop filter for H.264 decoding” select ALL 
Then in preference window Click Show Settings -> All. and expand Stream Output ->
Click Muxers ->select Mux module as “FFmpeg muxer”

next click

Expand Video -> Select Output module -> In Video Output module and select X11 video output.

and then save your settings

MT2S high definition files should play much more smoothly in VLC now.

Wednesday, March 7, 2012

Disable top left corner mouse Hotspot in Gnome 3

In Gnome 3, moving your mouse into the top left corner of your screen, simulates pressing (Alt-f1) or the Windows key, and puts you into search mode.  This can be extremely annoying when it happens accidentally.
 I prefer to only use the Keyboard for this feature.

to Disable the Mouse hotspot edit the following file

vim /usr/share/gnome-shell/js/ui/panel.js 

then search for the following line, flags);

and comment it out, by putting // infront of it
like so

//, flags);

save the file, and logout/login to your Gnome session.

no more annoying mouse hotspot.

my .zshrc file

# Lines configured by zsh-newuser-install
setopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/cgerada/.zshrc'

autoload -Uz compinit
# End of lines added by compinstall

#the following lines were added by cgerada
#autocompletion of hostname from ,ssh/known_hosts

local _myhosts
_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
zstyle ':completion:*' hosts $_myhosts
#Spelling autocorrect
setopt  correct

#coloured prompt
autoload -U colors && colors
PS1="%{$fg_bold[green]%}%n%{$reset_color%}@%{$fg_bold[blue]%}%m %{$fg_bold[yellow]%}%~ %{$reset_color%}%% "
# right hand prompt simple date and time only

#Extension aliases very cool
alias -s doc=libreoffice
alias -s xls=libreoffice
alias -s doc=libreoffice
alias -s pdf=evince



Moving from Bash to ZSH

I have Stopped using Bash and am now using ZSH as my new shell of Choice.
ZSH has many awesome features that make it a No brainer (for me anyway) to make the switch

Here's what I love about ZSH

1:) Your History is shared across sessions. Multiple simultaneously running zsh sessions can share history with each other. how many times have you looked into your bash history to find a recent command that you used, only to find that that command was run on a different terminal session and is no longer available to you.

2:) Tab Auto completion works between remote machines over SSH.

rsync -avr remotemachine:/home/cgerada/Documents/very/long/directory/na (at this point you can hit tab and provided that you connect to your remote host using ssh Key authentication instead of password authentication  zsh will autocomplete for you.

3:)No need to type cd to change into a Directory.
/home/cgerada/directory   enter

will change to /home/cgerada/directory  for you.
Considering how often you use the cd command, this is a real time saver.

4:) Tab auto completion works for command options
     rsync -av (hit tab here) will show you all possible options for the rsync command

5:) Built in Spell check
     How many times have you typed something like aptg-et or other mangled commands? Well,
     if you do that in zsh,You  get a message asking: “zsh: correct 'aptg-et' to 'apt-get' [nyae]?

6:) Built in pager.
     If your Lazy like me. And I think you are.  zsh comes with a pager directly in the shell. This means you
     can type things like " > README  and it is equivalent to less README or cat README | less"

7:)Right hand prompt
    Zsh supports a second (right hand prompt) great for adding the date and time (see screen shot above)
    or if you own a laptop you can also display your Battery capacity.  The right hand prompt will not get in
    your way as it disappears when your typing reaches it. or you can just not enable it if you don't want it.

8:) Known hosts auto completion. ZSH can even tab autocomplete hostname entries of remote machines that  
     you connect to from your .ssh/knownhosts file.

     in fact auto completion in all areas is far more superior in ZSH.

9:) Extension aliases

alias -s doc=libreoffice

putting the above in your .zshrc file allows you to open up a .doc file simply by typing its filename. eg

officedoc.doc  [enter]

will open up officedoc.doc using libre office (in Bash you would have had to type

libreoffice officedoc.doc
you can do the same for all extensions eg
alias -s pdf=evince
ZSH has loads more awesome features, and is highly customizable .  it behaves extremly similar to bash, in fact you can use it exactly the way you use bash and not learn or change a single thing and you won't be missing anything.

Right, so if you are convinced to make the change and jump right in.

install zsh by typing  yum install zsh or apt-get install zsh.

once installed simply type
chsh to change your shell  .
you will be asked for your user password
once typed in correctly you will be asked
New shell [/bin/bash]
type /bin/zsh   enter

and the next time you log into your shell with your username you will be in the ZSH shell.

If for what ever reason, you do not like zsh and want to revert back to bash
simply type
enter your password once again
and then type

will change your shell back to Bash.

Thursday, February 9, 2012

X11 connection rejected because of wrong authentication.

When you need to run an X window application over SSH.
You ssh -X into the remote machine, running X applications works fine, until you
sudo or su to another user to run an X application , You get the following error.
"X11 connection rejected because of wrong authentication.

X connection to localhost:10.0 broken (explicit kill or server shutdown)."

or if you connected using putty the error will read.
Xlib: PuTTY X11 proxy: wrong authentication protocol attempted”.

How to fix?

ssh cgerada@remote-server -X

cgerada $ su – oracle
oracle‘s Password:
oracle $ xclock

"X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown)".

or if you connected with putty the error reads

"Xlib: PuTTY X11 proxy: wrong authentication protocol attempted
xclock Xt error: Can’t open display: localhost:10.0"

On newer versions of  OpenSSH Server releases, you can simply enable “ForwardX11Trusted yes” in the /etc/ssh/sshd_config file and restart the OpenSSH server.
If you’re using an older version of  OpenSSH Server release then
You need to temporarily transfer the authorization to the other account. First, get the key from your account:
cgerada $ xauth list
fileserver/unix:10  MIT-MAGIC-COOKIE-96951c0622f80fd52186129dd06f2f6
Next, sudo/su to the other account and add the authorization key.
cgerada $ su – oracle
oracle $ xauth add fileserver/unix:10  MIT-MAGIC-COOKIE-96951c0622f80fd52186129dd06f2f6
Now, you should be able to start any X Windows application, 
oracle $ xclock

Saturday, January 28, 2012

Installing Fedora 16 on a System that can not boot GPT Labelled Disks

Some Systems Particularly Fujitsu Siemens Life books, Apple Macs and some others,
Cannot Boot If the Hard drive is Formatted using this Newer GPT  format.

Fedora 16 uses the new GPT format since it does have some benefits.
However if you want to install Fedora 16 on a Lifebook or an Apple mac, you need to do the following.

You need to pass parameter nogpt to the Fedora installer.

To do this, at the initial bootloader menu for the Fedora installation, where you can select to install, install in basic graphics mode, boot to the rescue mode and so on, hit the Tab key, then edit the command line for the Fedora installer and add the word nogpt.  you can do this when using the Live CD or the Complete distribution DVD.

Then install as normal and your Machine should now boot and work as expected.

Do not choose custom partitioning layout, You must let the system create it's own layout first and then if you want , You can edit what it creates to suite your requirements. If you choose custom layout, the 1MB problematic BootBios partition is created and this will give you the following error "
"you have not created a bootloader stage1 target device"

Monday, January 23, 2012

mount.nfs: access denied by server while mounting

If your nfs mounts stop working
and mount-a gives you the following error.
mount.nfs: access denied by server while mounting /blah_blah_blah/blah_blah

Chances are, your machine has been upgraded and now uses the NFS version 4 as default nfs version
 instead of 3

To fix this issue you need to explicitly tell nfs to mount your share using the older nfs version 3

simply add nfsvers=3  to your nfs mount stanza in your /etc/fstab file

vi /etc/fstab  /mnt/files nfs soft,intr,nfsvers=3 0 0

save the file and type
mount -a  

Your nfs mounts will now work.

Friday, January 6, 2012

Resolve transparency issues with Guake

If you set Guake to start automatically when your computer starts, depending on how quickly your Gnome session loads, there  may be an issue with it starting before Gnome has completed it's full initialization. 

when this happens, the transparency in quake does not work as it should, You cannot see the windows behind the Guake terminal, It lets you see your Background wallpaper only.

A solution for this is to delay the start up of Guake, so that Gnome is allowed to initialize fully before Guake starts.

To do this , run 

under startup-programs edit your entry for Guake.

and add  sleep 8 && infront of guake, 
like so

 sleep 8 && guake 

This gives guake an 8 second delay before starting, and should be enough to let Gnome fully initialize, and your transparency will work as it should.

Wednesday, January 4, 2012

Problem mounting a LVM

To  manually mount a drive that contains a LVM (Logical Volume)
do the following.


will output info about your logical volume
the important thing to note here is
the line which says VG Name
VG Name               vg_lvm

sometimes you will get a lv status as not available
to make it available type

vgchange -a y

this will activate any LVMS that werent active and make them available.

then to mount the LVM simply type

mount /dev/vg_lvm   /mnt