Sunday, 20 July 2014

vrms (Virtual Richard M. Stallman)

I was intrigued by the sound of the vrms (Virtual Richard M. Stallman) program when I was surfing the web. It analyses the packages you have installed on your Linux machine and reports all of those that are non free. Originally developed for Debian you can get it on Arch from the AUR. If you use 'packer' you can simple install with :

$ packer -S vrms-arch

The program when run enumerates non-free packages which officially is "under licenses not considered by OSI, FSF, and/or the DFSG to be Free Software".

More info on the license categorization is found via

$ vi /usr/lib/python3.4/site-packages/vrms_arch/

List non-free packages and count 'ambiguously licensed packages that vrms cannot certify.'

$ vrms

Check all packages in locally synced package repositories (does not and cannot include the AUR), not just locally installed packages:

 $ vrms -g

The caveats with this method in Arch are because many packages in Arch, both free and non-free, use custom as the license field value. This means that it does not use an exact copy of one of the licences includes in the core licences packages which you can view under :

$ ls /usr/share/licenses/common/

Some common licenses like BSD and MIT are not included in the common licenses packages as they require to be edited for a specific project.

Desite these cavets I found it a useful tool to run on my various Arch systems!

Vim Awesome a great way to find vim plugins

Vim is a great text editor with many plugins that have been developed over the years and continue to be developed. One issue I have found is that its difficult to keep track of plugins. Fortunately there is now a great site called that makes it easy. The data comes from GitHub, and user submissions.

The entries are categorised on the site so you can find plugins in areas you are interested in.

The site also displays the star rating from GitHub as well as the number of GitHub users so you can get a good idea of how well used and thought of the plugin is.

Wednesday, 16 July 2014

Combine bash history across multiple terminals

I use tmux (and many people also use screen) for multiple terminals. On slight down side is that by default the history command does not remember the commands between sessions on the same server. After some research and experimenting I found the following works really well in my .bashrc :

export HISTFILE=~/.bash_history
export HISTFILESIZE=500000
export HISTSIZE=500000

export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
export PROMPT_COMMAND="history -n;
history -w;history -c;history -r;$PROMPT_COMMAND"

Using 'Ctrl + R' will have the previous entries.

Note - if you are on session A run a command and move to session B you must either just press enter or another command before the entry in session A appears

Here is each line with some comments

  • Define where the history file is saved
export HISTFILE=~/.bash_history
  • How many commands to save in the HISTFILE
export HISTFILESIZE=500000
  • How many commands to save in the current session
export HISTSIZE=500000
  • Do not save duplicate commands and erase any previous duplicates
export HISTCONTROL=ignoredups:erasedups
  • How the history list is written to the HISTFILE. The '-s' option sets the option to append the history list of the current session to HISTFILE
shopt -s histappend
  • Clear current value of PROMPT_COMMAND
  • Contents of PROMPT_COMMAND are run just before Bash displays a prompt. This will save and reload the history after every command
  •  -n : Append the new history lines
  •  -w : Write history which will cause 'erasedups' to occur
  •  -c : Clear the history list
  •  -r : read the current history file 
export PROMPT_COMMAND="history -n;history -w;history -c;history -r;$PROMPT_COMMAND"

 Hope you find this as useful as I have :)

Monday, 14 July 2014

Ubuntu/Arch Linux : USB Error Input/output error NTFS is either inconsistent, or there is a hardware fault

It can be quite common to use a USB drive on your Linux box and then have to copy file to a Windows computer. When you reconnect the USB drive to your Linux box you may get a similar Error to the following :

Failed to mount '/dev/sdd1?: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's softRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice.

This can seem a bit daunting but thankfully the solution is quick by installing 'ntfsprogs'. ntfsprogs is a suite of NTFS utilities based around a shared library.


$ pacman -S ntfsprogs


$ sudo apt-get install ntfsprogs

Then run the command (note : change the drive to match the same as you get with the error) :

$ sudo ntfsfix /dev/sdd1

See the man file for full details.

$ man ntfsprogs             

Saturday, 12 July 2014

Reasons not to kill -9 a process in Linux

Its something that is very common and we have all done it in our time. You have a process that is not running the way you want it or maybe it has hung. The solution seems obvious :

$ kill -9 <pid>

I had been told in the past this was a bad idea but why is this not good. There are a few reasons I have found out. When you just kill -9 a process it will not :

- Let its children know that it no longer exists

- Will not shut down its socket connections

- Temp files will not be cleaned up

In general kill -9 should only be used as a last resort as you could at some point end up corrupting an important program e.g. a database.

The recommend procedure to use is :

$ kill -15 <pid>

This allows the target process to try and clean up after itself. If that does not work in order :

$ kill -2 <pid>

$ kill -2 <pid>

And finally ;

$ kill -9 <pid>

Like anything it just takes a bit of getting used to and after 6 months on following this I believe this is a good personal practise to follow.

You can get a full list of the signals with :

$ kill -l

Sunday, 13 April 2014

Firefox Aurora & Chrome Dev for Linux Mint : Preview upcoming features

I have been wanting to have the most up to date browsers for Linux Mint as its great to be able to see the cutting edge features before they are fully deployed.

This post shows how you can quickly setup Firefox Aurora and Chrome Dev builds on Linux Mint (will also work on Ubuntu as well).

Note : you cannot also run the Stable versions of Firefox & Chrome and the same time so they will be replaced.

Firefox Aurora

First update the repository from Mozilla to Aurora  :

$ sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora

Then update the repositories and install Firefox :

$ sudo apt-get update
$ sudo apt-get install firefox

Restart Firefox and you will now have the Aurora version. The Sotware Manager also recognized the change and updated to Aurora. All the bookmarks, settings etc will be the same as the stable Firefox version.

Chrome Dev Channel

The slight difference with Chrome is that you need to remove the installed package. First go to the Chrome Release Channels and download the Dev Channel unstable build for you OS architecture.

Next remove the current Chrome stable build :

$ sudo dpkg -r google-chrome-stable

Install the downloaded build :

$ sudo dpkg -i google-chrome-unstable_current_amd64.deb

Startup Chrome and enjoy being on the Dev channel builds!

Setup latest NVIDIA Drivers for Ubuntu or Linux Mint

  • If you need to install NVIDIA Driver's on either Ubuntu or Linux Mint the following three commands will update your system with the latest available drivers

$ sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
$ sudo apt-get update
$ sudo apt-get install nvidia-current nvidia-settings

  • Reboot your system and the drivers should be applied
  • For more detailed configuration open the 'NVIDIA X Server Settings Applet'