Saturday, 27 April 2013

Cento 6/RHEL install Vim text editor and Vi key bindings in shell.

Vim editor is one of the best simple editors for Linux, being an offshoot of the original vi editor written by Bill Joy a while ago. Vi is now a standard piece of equipment for many Linux distros and is often installed by default. It is quite easy to use and although a little quirky at first for some, the quirks soon become de rigueur and you tend to miss them when using another editor. 

Vim is the enhanced version by Bram Moolenaar and you should use it in your Centos 6/RHEL desktop as it provides some useful extra features. 

There is also a wiki for vim which contains 1,599 pages & a photo gallery. This is also a good source of tips and thoughts on the ineffable power of vim. It has become something of a web standard and there are a considerable number of articles and tutorials on the subject all over the web.

To install it just use yum.

$ sudo yum -y install vim-enhanced

This gets you the necessary files including common etc with a graphic desktop (gvim) & console version being installed.

$ vi   

Terminal Vim
Graphical Gvim
Vim in the shell 

The first thing I'd recommend doing before anything else is to place the following line in the ~/bashrc file.

$ sudo vi ~/.bashrc                  

set -o vi

This will apply the vi key bindings to your bash shell and you can use them as you type out commands. So you will have the same two modes in the shell as you do in vim, Insert and Command.

In the shell by default you will be in insert mode so just type as normal.

Hit 'Esc' to go into command mode and use the vi commands in the shell, such as $ to go the end of the line or 0 to go to the beginning of the line.

More below 
  • b to go back one word
  • 2b to go back two words
  • dw to delete a word
  • dd to delete the entire line
  • d$ to delete to the end of the line (from cursor)
  • d0 to delete to the beginning of the line (from cursor)
  • w to go forward one word
To return back to insert mode type 'i' (as in vi) and you can
then use the terminal as normal.

Vim in vim

Using Vi or Vim, the basic commands you need to actually write files are 'i' to insert text and 'Esc ZZ' to save and exit.                    

In the command mode, you can move around the file, delete text, etc.

In the insert mode, you can insert text.

Changing mode from one to another

From command mode to insert mode type a/A/i/I/o/O ( see details below)

From insert mode to command mode type Esc (escape key)

Some useful commands for VIM

Text Entry Commands (Used to start text entry)

a Append text following current cursor position

A Append text to the end of current line

i Insert text before the current cursor position

I Insert text at the beginning of the cursor line

o Open up a new line following the current line and add text there

O Open up a new line in front of the current line and add text there

The following commands are used only in the commands mode.

Cursor Movement Commands

h Moves the cursor one character to the left

l Moves the cursor one character to the right

k Moves the cursor up one line

j Moves the cursor down one line

nG or :n Cursor goes to the specified (n) line

(ex. 10G goes to line 10)

^F (CTRl F) Forward screenful

^B Backward screenful

^f One page forward

^b One page backward

^U Up half screenful

^D Down half screenful

$ Move cursor to the end of current line

0 (zero) Move cursor to the beginning of current line

w Forward one word

b Backward one word

Exit Commands

:wq Write file to disk and quit the editor

:q! Quit (no warning)

:q Quit (a warning is printed if a modified file has not been saved)

ZZ Save workspace and quit the editor (same as :wq)

: 10,25 w temp

write lines 10 through 25 into file named temp. Of course, other line

numbers can be used. (Use :f to find out the line numbers you want.

Text Deletion Commands

x Delete character

dw Delete word from cursor on

db Delete word backward

dd Delete line

d$ Delete to end of line

d^ (d caret, not CTRL d) Delete to beginning of line

Yank (has most of the options of delete)-- VI's copy commmand

yy yank current line

y$ yank to end of current line from cursor

yw yank from cursor to end of current word

5yy yank, for example, 5 lines

Paste (used after delete or yank to recover lines.)

p paste below cursor

P paste above cursor

"2p paste from buffer 2 (there are 9)

u Undo last change

U Restore line

J Join next line down to the end of the current line

File Manipulation Commands

:w Write workspace to original file

:w file Write workspace to named file

:e file Start editing a new file

:r file Read contents of a file to the workspace

To create a page break, while in the insert mode, press the CTRL key

And l. ^L will appear in your text and will cause the printer to start a new page.

Other Useful Commands

Most commands can be repeated n times by typing a number, n, before

the command. For example 10dd means delete 10 lines.

. Repeat last command

cw Change current word to a new word

r Replace one character at the cursor position

R Begin overstrike or replace mode – use ESC key to exit

:/ pattern Search forward for the pattern

:? pattern Search backward for the pattern

n (used after either of the 2 search commands above to

continue to find next occurrence of the pattern.

:g/pat1/s//pat2/g replace every occurrence of pattern1 (pat1) with


Example :g/tIO/s//Ada.Text_IO/g

This will find and replace tIO by Ada.text_IO everywhere in the file.

:g/a/s// /g replace the letter a, by blank

:g/a/s///g replace a by nothing

note: Even this command be undone by u


Opening a New File

Step 1 type vim filename   (create a file named filename)

Step 2 type i   ( switch to insert mode)

Step 3 enter text (enter your Ada program)

Step 4 hit Esc key   (switch back to command mode)

Step 5 type :wq   (write file and exit vim)

Editing the Existing File

Step 1 type vim filename   (edit the existing file named filename)

Step 2 move around the file using h/j/k/l key or any appropriate command

h Moves the cursor one character to the left

l Moves the cursor one character to the right

k Moves the cursor up one line

j Moves the cursor down one line

nG or :n Cursor goes to the specified (n) line

(ex. 10G goes to line 10)

Step 3 edit required text (replace or delete or insert)

Step 4 hit Esc key (exit from insert mode if you insert or replace text)

Step 5 type :wq

Wednesday, 24 April 2013

Centos 6/RHEL install Gnumeric Spreadsheet tool

Gnumeric, the GTK based free GNU licensed spreadsheet tool from the Gnome project is a surprisingly useful application if you do a lot of spreadsheet work on Linux.

It is fast, lightweight & Excel compatible with an enormous
function inventory, many of which aren't in the Microsoft version. 588 functions, 196 totally unique to Gnumeric is an impressive list by most individual's standards. See Function reference

Gnumeric includes an array of features allowing users to create interesting and informative graphs, thus maximising the effectiveness of a presentation. The graphs are easily customisable to add or change features such as titles, labels, fonts, backplane, count etc by right clicking on the plot and selecting properties. The graphs are much simpler in appearance
than in Excel but they succeed in conveying the message.

The graph can be downloaded as svg, jpg or other formats.

To quote the Gnumeric developers 'Gnumeric aims to be the best spreadsheet available', a bold claim in the light of heavyweight competition from Microsoft and others but if you are using Linux or you dislike the 3D graphics in Excel post 2007 then it can be a useful tool to have on your desktop. Features such as text file import and others are included with it.

Gnumeric is in the standard Epel repo so as long as you have it installed you can simply issue the command

$ sudo yum -y install gnumeric               run it with

$ gnumeric

See Fluxbox key bindings to add keyboard shortcuts.

Saturday, 20 April 2013

Centos 6/RHEL install Shutter Screen Capture

Shutter is a fully featured multilingual screen-shot capture program using gnome-web-photo (for web pages) and with a huge array of features and plug-ins.

It is free to use and is available for Centos 6/RHEL users via 
nux-dextop repo for any architecture.
URL Capture
Some of its many features include auto generated file names, 
web page capture via URL, tabbed captures, 
individual navigator windows, 
full size web page capture, zoom to selection area, 
pre-capture re-size, 
plug-ins such as 3d Rotate & Fish-Eye.
It has a built in tool box with numerous functions including 
cropping to size and a censor button to hide private data 
which you may not want to appear.

For more detailed information see

To obtain nux-dextop first install wget if not installed. 
$ sudo yum -y install wget   

$ wget 
$ wget 
for the repo pack

$ sudo rpm -Uvh nux-dextop-release-0-1.el6.nux.noarch.rpm

to install it. 
$ sudo vi /etc/yum.repos.d/nux-dextop.repo   

set 'enabled' to '0'

$ sudo yum -y --enablerepo=nux-dextop install shutter

Typical commands would be something like

$ shutter -a -p=myprofile --min_at_startup
$ shutter -s=100,100,300,300 -e    (-s size)  

An useful tool for the more adventurous screen shooters who
possess some degree of artistic ability and wish to exercise
more control over their material.
Check out ImageMagick for startlingly quick screen imports.
More repos 

Friday, 19 April 2013

Centos 6/RHEL install Xvidcap

Xvidcap is a neat little screen capture tool using the ffmpeg libavcodec/libavformat libraries, originally conceived by 
Rasca but later taken over and developed by Karl H. Beckers.

It is able to dump single frame capture's as xwd, pgm, ppm, png, jpg as well as multi frame (video) captures in mpeg, dv, divX, flv and others, so a decent choice for your screenings.

The output quality is nicely configurable with the default file being mpeg or optionally a variety of other formats such as flv,
mp4, mov, dv etc.

Below is a short video of xvidcap setup after installation.

You might want to check out Krut screen capture also.

You get obtain it as an install shell script from sourceforge
or you an use the nux-dextop repo, which is how we do it here.

So first obtain nux-dextop & install wget.

If you are using SMPlayer then install that first or there will be conflicts with nux-dextop files.

$ sudo yum -y install wget                           

$ wget


$ wget

Then install the downloaded repo pack       

$ sudo rpm -Uvh nux-dextop-release-0-1.el6.nux.noarch.rpm

Make sure it i disabled then

$ sudo yum -y --enablerepo=nux-dextop install xvidcap

After downloading a few dependencies you will have xvidcap ready to go.

You can run it with 

$ xvidcap

I found Xvidcap to be great for multi-frame (video) capture, however, I would prefer ImageMagick for quick single screen shots
as it is probably a little more flexible.

Xvidcap is an useful & functional tool for your Linux desktop.

Thursday, 18 April 2013

Centos 6/RHEL install Midnight Commander console file manager

Midnight Commander is an old style console file manager which is easy to install and use on Centos 6/RHEL. It can be very useful in certain situations, such as when the cp command refuses to overwrite a file or folder because it 'exists', enabling you to get some things done which you couldn't accomplish with cp, mv or rm. It can be used both locally and remotely and in a console or under X Window System. You can compile from source or just use the repo version as below.

To obtain it from the standard repo, just issue the command

$ sudo yum -y install mc

Fire it up either in the console or terminal emulator with

$ mc

It opens up with 2 panes for you to navigate between, starting in whichever directory you happen to be in.

Some basic commands for mc are listed below to get started.

Tab  --  Change between panels

Arrows Up/Down --  Scroll up and down

Arrows Left/Right -- Go to parent directory

F5 -- Copy

F6 -- Move or Rename

F9 -- Access the menu bar at the top

F10 -- Quit

A list of the F key functions is laid out at the bottom.

$ man mc                     for more info, flags etc.

Check out for more.

Midnight Commander is a handy little tool, along with Elinks Text Browser for accomplishing certain jobs in Linux.

Monday, 15 April 2013

Centos 6/RHEL install Redis Database Server & Jedis Java Connecter

Redis database is an open source persistant key-value store, or data structure server in which keys can contain an assortment of strings, hashes, lists, sets and sorted sets. Written in ANSI C and originally sponsored by VMWare, it works on all POSIX-compliant Unix systems.

Here are some benchmarks for CentOS as a Virtual Machine

GET: 2801 rps
SET: 36101 rps
INCR: 36496 rps
LPUSH: 38759 rps
LPOP: 38610 rps

an average of approximately 36000.

All with 1024 byte payloads

Redis has an extremely light footprint and small file size. It is easy to compile from source but for now I just have it installed straight from the repo as supplied.

$ sudo yum -y install redis

The little Redis book by Karl Seguin is available below

There are also a variety of client plugins available at and the one I use here for Java is Jedis.

Jedis is a blindingly fast Redis client for Java by Xetorthio on GitHub, so first download it. 

You will need Java JDK & Eclipse installed first.

Below is a video of a small test program in Java using Jedis to connect to a Redis database, store some characters, then retrieve some characters to display on screen.

You might also want to take a quick look at Krut screen capture 
or Xvidcap.

To recreate this or similar having installed Redis database as above, download Jedis jar file and set up a little test in Eclipse (New Java project - 'Test Redis', New Package - 'anything', New Class - 'JedisTest') Then create an empty lib folder in your project and copy the code below into your class file.

import redis.clients.jedis.Jedis;

public class JedisTest {

    //Store a string into Redis then
    //select the characters to print out
    //tinfoil, for no particular reason whatsoever.
    public static void main(String[] args) {
        Jedis jedis = new Jedis("localhost");
        jedis.set("foo", "thetestingstringforredisjavaapplication");
        String value = jedis.get("foo");

Use the import from file system to locate your Jedis jar and import it. Then right click on it and add it to the build path. You will see the jar copied from from the lib to the referenced libraries folder as indicated in the video.

Make sure that you have started Redis server with

$ sudo service redis start

And that your test project is set up correctly with the build path to Jedis and no errors.

Just run as a standard Java Application, Hit Ctrl + F11 your string should be stored and the required
characters retrieved and displayed as shown.

So, Redis and Jedis, fast and lightweight database storage using Java.

Jedis facilitates the following operations
  • Sorting
  • Connection handling
  • Commands operating on any kind of values
  • Commands operating on string values
  • Commands operating on hashes
  • Commands operating on lists
  • Commands operating on sets
  • Commands operating on sorted sets
  • Transactions
  • Pipelining
  • Publish/Subscribe
  • Persistence control commands
  • Remote server control commands
  • Connection pooling
  • Sharding (MD5, MurmureHash)
  • Key-tags for sharding
  • Sharding with pipelining
So it is worth checking out if you are using Java with Redis.

Saturday, 13 April 2013

Centos 6/RHEL import Screenshot with ImageMagick

Sometimes you want to get a quick screenshot but don't want to go to the lengths of opening up a full blown graphics program like Gimp, Cinepaint, Shutter etc.

If you have ImageMagick installed you can quickly grab an area of the screen you are working on by simply issuing the import command on the fly, giving the resulting file any name you like.

First install ImageMagick

$ sudo yum -y install ImageMagick

Click and Drag shots

$ import screenshot1.png

$ import screenshot2.jpg

$ import screenshot3.gif

$ import screenshot4.tiff

Or resize it on the fly with

$ import -resize 700 blogshot.png 

$ import -resize 50 iconicshot.ico

Then drag the mouse around the area you want to capture, on release the resulting file is saved under the name assigned to it.

                                                                 If you want to capture the entire screen and add a delay so you can open/close something, then that's straightforward

$ sleep 10; import -window root wholescreen.png

This will impart the desired delay and then save the file into the named png '-window root' being the entire screen.

A wide range of filetypes are supported for saving.

You can also resize Fullscreen shots with ImageMagick on the fly, say to 600 pixels

$ import -window root -resize 600 resized600shot.png

Add a sleep function to get things out of the way

$ sleep 5; import -window root -resize 600 noclutter.png

Instant editing in Gimp

You can additionally, take a Fullscreen shot, with or without delay, give the file a name and type, then import straight into Gimp for further editing.

Fullscreen shots

$ import -window root screenshot.png; gimp screenshot.png;

$ sleep 5; import -window root screenshot.png; gimp screenshot.png;

With Fullscreen shots you would almost always have to add the sleep function to facilitate removing unwanted obstacles, like the terminal in the above.
A Quick recap

A shot sized up with the mouse
$ import filename.type 

Fullscreen into gimp      

$ sleep 5; import -window root filename.type; gimp filename.type;

Fullscreen resized into gimp
sleep 5; import -window root -resize 600 filename.type; gimp filename.type;

The following command takes a Fullscreen shot of the video being watched in SMPlayer, resizes it to 600 then opens it up in Gimp for more editing.

$ sleep 5; import -window root -resize 600 shot.png; gimp shot.png

Favorites from a memorisation point of view are

$ import anygrab.png         

$ import -resize 600 anygrab.png

Because you can still grab most of the screen if you place your terminal at the bottom. 

Filetypes supported by ImageMagick




Not all the above will be suitable for the import command.

For more information and commands check the help pages.

$ import -help

Which will supply you with many more options and combinations.

For a screenshot program with more features see Shutter.

Tuesday, 9 April 2013

Centos 6/RHEL install QtWeb Browser

A clever little free open source browser from the LogicWare and Lsoft people is QtWeb Browser.

Based on Webkit and Nokia's QT frameworks, it is a fast and secure browser with a veritable multitude of useful features built in to it. It is cross platform and usable from a USB drive so you can carry it around with you if necessary.

Some of the features include
  • Customizable user interface
  • You can move the navigation bar and bookmarks bar anywhere.
  • Customizable search providers, menu titles, assign hot keys
  • Show hide toolbar buttons and toolbars.
  • Tabbed browsing is the default, & non-tabbed.
  • Html 5, CSS, Frames, Javascript and Cookies
  • Web Inspector
  • FTP Browsing and Downloading
  • Built in Torrent client
  • Support for plugins, Flash, Quick Time, Java etc.
Adding it to your Centos /RHEL box is just simply a case of downloading the Linux variant from the QtWeb site unzipping and chmodding it to execute.

$ unzip

$ chmod u+x QtWeb 

Run it with                          

$ ./QtWeb

It runs surprising smoothly on a minimal Centos box and it packs some formidably useful features into it's tiny frame (13mb).

With tools including Web Inspector, Compatibilty, Privacy and built in Torrent client it is not dissimilar to Mozilla Firefox in features but seems to run a shade quicker.

Remember that to obtain Flash, Java etc plugin functionality it is best to have Firefox installed beforehand.

QtWeb on Centos 6/RHEL shown above with the compatibility views available in the dropdown box top right using a HTML5 Template courtesy of Free HTML5 Templates.

The QtWeb project builders are refreshingly disarming and the impression you get from them is that it is just 'something thrown together during coffee break' but I'd give it a little more credit than that.

There are also portable versions available for Linux and Windows
which run from a USB drive so you can carry it around and hook it up to other portable apps like editors, image programs etc, which you can put in it's folder on the drive. These are true portable versions which work straight from the drive without installation
and are faster than other portable browsers. The built in torrent functionality is especially useful in the portable version effectively enabling you to download torrents on any computer.

So head over to QtWeb and take a look at it, you might get a pleasant surprise.

Friday, 5 April 2013

Centos 6/RHEL install yEd Graph Editor

If you are looking for free Linux alternative to Microsoft Visio to use on your Centos 6/RHEL (or any other) box then the impressive yEd from is a program ripe for perusal and definitely worth a few minutes of your time.

There could be a number of reasons why you do not wish to go down the Microsoft route, you may have decided that Linux is your preference and want to use it as your main OS.

You might not work or play in an environment which uses Windows much and you may be looking for a functional way to create graphs in a Unix based setup.

The most likely reason will probably be that you have not , for whatever reason, been trousering billions for the last 30 years (a very serious oversight), you have a number of machines to accommodate and simply do not wish to or cannot pay the license fee that is necessary to run Visio on one of them.

yEd is a powerful desktop application that can be used to quickly and effectively generate high-quality diagrams. You can create diagrams manually, or import your external data for analysis. The built in automatic layout algorithms arrange even large data sets with just the press of a button.

yEd save and export types 

It IS cross platform as well as free so you can run it along side Visio on Windows if you prefer and make use of both products.

Installing on Linux is via a shell script and although it is available as a jar file runnable with java, I chose the install route on this occasion although another time I might well use the java version. Download it to your home directory and chmod.

$ chmod +x

$ ./

You can create Tree, Grid, Planar and Random graphs in a variety of layouts, Hierarchical, Organic, Orthogonal, Circular and Tree.
It also has specific functions for Swimlane, Flowchart and Family Tree. A variety of samples are available from the help menu to start you off, along with links to online resources and a short introductory tutorial.

Additionally, the yFiles product family offers high-quality diagramming for Java and .NET applications (Windows Forms and WPF) as well as for web applications based on HTML5/JavaScript, Apache Flex or AJAX technologies, or the Microsoft Silverlight framework. 

You may eventually decide to break out a few dollars and purchase one or more of yWorks other products although as a caveat I would warn that these are exponentially higher than Microsoft's by an average factor of approximately 10 with a not insignificant subscription fee payable annually on top.

The quality, however is superb, the cross platform availabilty will be useful for many and my overall impression of yWorks is one of an extremely positive and professional company with considerable expertise at their disposal.

Monday, 1 April 2013

Centos 6/RHEL install Ikog To-Do List manager

For those who like to play around in the terminal and have cool touch typing skills, IKog is a ToDo list manager that embodies the GTD methodology popular amongst those not at risk from heart attacks, suicide or corporate burnout and who are guaranteed to actually have enough money to live to be 100.

Whether you are a corporate high flyer with a huge empire to run, or conversely you are not and are surviving on the income of a small, elderly, partially blind chipmunk, Ikog can still become a useful and necessary part of your Linux tool box. 

iKog-js is deceptively powerful, it originally started life as a console application run as a python script but now you can use the web based version also, see link at the bottom of the page.

Run it locally 

Download the 1.90 version from below which includes PDF guide.


In its original form Ikog is a small python script that weighs in at 100kb.

If you have Python 2.6 running in your system (part of the standard Centos installation), getting iKog to run is as simple as running the script with the command

$ python

There are a lot of functions you can use with ikog so I would advise reading the enclosed manual if you wish to become adept with it. For the most part you would run it as above, then create a dat file to store your messages using the export command. Below is an image of this being done at installation.

Pop in a quick message to test it works OK.

>>>Routine entry to test that it works

Export the file first to a text file


Clear the program with 

>>>clear      (yes at the prompt)

Close the terminal and start a new one, in this terminal first rename the txt file which you just exported.

$ mv      

Now run Ikog with python and you will see that in the header it now automatically uses your dat file as the data source.

$ python

You can add simple tasks (command: “+ your task name”) or give your task a due date (command: “+ your task name :d2009-04-20“).

To view your task list, simply type in the command 'list'. For more information on the usage of iKog, refer to the documentation on its site.

In the event that you wish to print your task list, iKog also allows you to export your list to HTML format so that you can easily print/view from your browser.

In it's most basic form, just use the following  @>


Which will perform the export to html file.

There are plenty of other options should you want to expand upon it's use but for ordinary day to day tasks the above is a useful quick start guide.

Run the web based version

Ikog is now also available as a Web based application which you can use in conjunction with Dropbox.