wcalc: powerful scientific calculator

wcalc_compI had been using GUI based calculators SpeedCrunch and Galculator for long. Recently I got addicted to the drop-down terminal AltYo and tend to do everything from the terminal. I found the feature-rich wcalc, which can literally do anything you might expect from a scientific calculator. One of its powerful features is the support for variables which allows you to use it like a programming language. wcalc is a very old utility. The development started in early 2002. Continue reading wcalc: powerful scientific calculator

undistract-me: terminal job notifications

terminalIt’s quite boring to keep watching the terminal till a long-running command completes. I would rather use the time doing something useful. But how do I know when the command competes? The answer on Ubuntu is a simple utility called undistract-me. It uses notify-osd to update you when a console command finishes.


To install undistract-me on Ubuntu:

$ sudo apt-get install undistract-me


On my system undistract-me did not work out of the box. I added the following in my ~/.bashrc to get it working:

. /usr/share/undistract-me/long-running.bash

By default the utility notifies you with the execution time when a command or task takes more that 10 seconds to complete. You can override it by exporting the following:

// notify if execution time > 5 seconds 

If you don’t want certain commands to be ignored use the following (space separated list):

$ export LONG_RUNNING_IGNORE_LIST=mv cp rsync

On GitHub: undistract-me

Ag: fast grep & ack alternative

search_compgrep is one of the most commonly used utilities on Linux. ack is a faster replacement of grep written purely in portable Perl 5 and takes advantage of the power of Perl’s regular expressions. ack is optimized for searching version controlled source code.

Ag or The Silver Searcher (ag chemically represents the element silver) is an optimized replacement for ack. It is 3 to 5 times faster than ack and targets source code search. It ignores file patterns from directories created by version control systems. If there are files in your source repo you don’t want to search, just add their patterns to a .agignore file.

The author explains the tweaks that make Ag so fast:

  • Searching for literals (no regex) uses Boyer-Moore-Horspool strstr.
  • Files are mmap()ed instead of read into a buffer.
  • If built with PCRE 8.21 or greater, regex searches use the JIT compiler.
  • Ag calls pcre_study() before executing the regex on a jillion files.
  • Instead of calling fnmatch() on every pattern in ignore files, non-regex patterns are loaded into an array and binary searched.
  • Ag uses Pthreads to take advantage of multiple CPU cores and search files in parallel.

Tempted to try it out? To install Ag on Ubuntu:

$ sudo apt-get install silversearcher-ag

You can integrate Ag in vim using the ack.vim plugin. Add the following line to your .vimrc:

let g:ackprg = 'ag --nogroup --nocolor --column'

The cmdline options are similar to grep. A common search using Ag is:

$ ag -anr "search_string" *
a: include all files
n: show line numbers
r: search recursivel

Here are my benchmarks with grep and Ag:

$ time grep -nr "fprintf" *
real    0m0.043s
user    0m0.031s
sys    0m0.011s
$ time ag -anr "fprintf" *
real    0m0.033s
user    0m0.045s
sys    0m0.034s

Real is wall clock time – time from start to finish of the call.
User is the amount of CPU time spent in user-mode code (outside the kernel) within the process.
Sys is the amount of CPU time spent in the kernel within the process.

The results are consistent. Ag does more processing but completes faster (Real time) than grep.

Webpage: Ag

Similar software

  • jrep is a grep-like utility powered by regular expression compiler rejit.

patool: extract archives with one tool

I remember a former colleague who would always confuse the switches for gzip and bzip2 to tar. That led to a lot of confusion among people when he sent packages to them. However, I do not blame him. Using compressed archive files on Linux needs you to remember a lot of switches. Though tar can detect the file format (gzip/bzip2) nowadays while extracting, how about a tool that could handle many more compression types? Continue reading patool: extract archives with one tool

newsbeuter: quick setup guide on Ubuntu

I keep in touch with open source and Linux updates through news and RSS feeds. I had been using canto for a year or so. Another terminal based RSS/news feed reader caught my attention recently – newsbeuter. The interface is unobtrusive and organized. Besides it has some powerful features:

  • Subscribe to RSS 0.9x, 1.0, 2.0 and Atom feeds
  • Download podcasts
  • Freely configure your keyboard shortcuts
  • Search through all downloaded articles
  • Categorize and query your subscriptions with a flexible tag system
  • Integrate any data source through a flexible filter and plugin system
  • Automatically remove unwanted articles through a “killfile”
  • Define “meta feeds” using a powerful query language
  • Synchronize newsbeuter with your bloglines.com account
  • Import and export your subscriptions in OPML format
  • Customize look ‘n feel through color configuration and format strings

I took around an hour to set it up because of the number of options it has but it was worth the time. Here’s the quick and dirty way to setup newsbeuter on Ubuntu and keep in touch with the latest buzz in your field of interest from the terminal.

  1. Install it from the Ubuntu official repos:
    $ sudo apt-get install newsbeuter
  2. The first time you run it you will get the following error:
    Error: no URLs configured. Please fill the file /home/ak/.newsbeuter/urls with RSS feed URLs or import an OPML file.
  3. Create the ~/.newsbeuter/urls file. Add some RSS feed links. E.g.:
  4. newsbeuter should run with default configuration options now. But you would definitely want to fine-tune it to your own liking. Create the file ~/.newsbeuter/config and add the configuration options you want. The man page should help. You can also refer to the official docs. Here are my configuration options:
    refresh-on-startup yes
    browser firefox
    color listnormal_unread cyan black
    datetime-format "%b %d %R"
    max-items 20
    keep-articles-days 3
    show-read-feeds no
    show-read-articles no
    mark-as-read-on-hover yes

And that’s how I got the application up and running. Till now I am more than happy with the experience. newsbeuter can very well become my default RSS/news feed reader soon.

Webpage: newsbeuter

reptyr: move programs between terminals

terminalreptyr solves a very common problem faced by terminal users on Linux – how to move a running process from one terminal to another? reptyr does a more thorough job of transferring programs than many other tools because it changes the program’s controlling terminal. This means that actions such as window resizes and interrupts are sent to the process from the new terminal. It is very useful for moving a long-running process into a GNU screen session and for users like me out there, it is absolutely a must. With reptyr you can end a ssh session without terminating the process running in it on the remote machine by just attaching the ssh session to a new terminal.

Here’s another use case from my personal experience: often I fire different programs in different terminals but when the task in the terminal I am currently on is over, I like to pull back the another task to this terminal without having to switch terminals. reptyr does this for me.

It’s worthy to mention screenify here, a small script to make processes talk to the current terminal. But it suffers from problems like some processes still take inputs from the older terminal, resizing the new terminal doesn’t affect a ncurses based program or <Ctrl-c> won’t work in the newer terminal. reptyr takes care of all these issues too!

Install reptyr on Ubuntu:

$ sudo apt-get install reptyr

To attach a process to a terminal, run the following command from the terminal:

$ reptyr PID

How to get the PID of a process? Simple! Run the following:

$ ps -ax | grep process_name
$ ps -ax | grep ssh

reptyr can also create a new pseudo-terminal pair with nothing attached to the slave end, and print its name out. Run:

$ reptyr -l

In case you keep getting the following error with reptyr (I faced this on Ubuntu 14.04):

$ reptyr 1851
Unable to attach to pid 1851: Operation not permitted
The kernel denied permission while attaching. If your uid matches
the target's, check the value of /proc/sys/kernel/yama/ptrace_scope.
For more information, see /etc/sysctl.d/10-ptrace.conf

It means that your kernel is running in a lesser permissive mode when it comes to attaching processes. Only attaching direct child processes are allowed to harden the kernel. To get reptyr working (at your own risk), edit /etc/sysctl.d/10-ptrace.conf, and set:

kernel.yama.ptrace_scope = 0

Then reload the sysctl rule:

$ sudo sysctl -p /etc/sysctl.d/10-ptrace.conf

Webpage: reptyr

Console based note managers

xtnotepadAll of us keep notes. In my case I like to keep them organized and I use note managers for that. Though I have initially used graphical note managers cherrytree, springseed etc. because of the visual editing features they provide, I realized at one point that I do not need so many bells and whistles. Many of these tools are bulky, some of them are slow starters and most of them provide more options than you want to handle. So I fell back to console based note managers. Here are some of those I like and find very easy to use and simple to understand. They just manage a number of notes and provide you options to edit them in your favourite editor.

  • note
    As simple as it can be. Type note and it shows you the options to list notes, show topics, add, delete, search and edit new notes. The notes are saved as plain text and you can add the editor of your choice in the configuration file. Mine is vi. Note stores the documents in mysql format and supports IDEA or DES encryption.
  • nodau
    The basic features are similar to note but you always need to start nodau with an option which seemed little obtrusive to me. Isn’t remembering the name of the program enough? You can have encrypted notes with nodau.
  • theca
    Rust utility to take notes with 256-bit AES encryption, multiple profiles, search support.

My favourite is note.

Canto: console based Linux RSS/news feed reader


In a past post I wrote about Feedly as an alternative to Google Reader. It’s definitely good but practically speaking I just love to skim through the list of feeds and open only the ones those I think would be interesting. I found exactly what I wanted – Canto. If you are thinking it’s primitive, check out the features:

  • Open any feed anytme in the browser of your choice
  • Unicode support
  • Supports both RSS, ATOM and RDF feeds.
  • Import/export feeds in OPML format
  • Theming through configuration
  • As will most Linux utilities, it is extremely flexible and can be configured to your liking
  • Very very lightweight and fast as it just downloads the feed information and no images or the full text of the news
  • For a distraction free reading, make you console fullscreen (F11) and try it out
  • Available in synaptic on Ubuntu

To install canto on Ubuntu, run:

$ sudo apt-get install canto


  • For help, run canto -h or man canto or press h when canto is open.


All your configuration goes into ~/.canto/conf.py file. Download mine from here. I have added:

  • some feeds
  • a filter not to show read articles
  • google-chrome to open the links
    you can choose to use elinks but 1. the learning curve might be steep and 2. if you want to read the full news, why not open it in the default browser?

Basic navigation

  • To execute canto, run
    $ canto //run canto
    $ canto -a //just refresh the feeds
    $ canto -u //update feeds & open canto, you can alias this in ~/.bashrc
  • Up and Down keys navigate through the feed list.
  • Use Left and Right to mark unread and read from feed list without opening.
    Use r to mark all stories in a feed/group as read. R marks everything as read.
  • Press f in feed list to search and highlight matching feeds.
  • Use Space to open details of a feed in a new frame (feed frame) and Space again to go back to feed list.
    To open directly in the browser bring the cursor to the feed and press g.
  • When within a feed frame, type g 0 (then Enter) to open it in browser. 0 is the index to the link.
    Similarly you can open other links using g n, where n is the link number in [] shown beside the link.
  • Press n and p to jump to next and previous feed from the feed frame.
  • Press l (small L) in the feed frame to expand all the links in the feed.
  • Press Ctrl-R to refresh all feeds.
  • To quit press q in the default feed list page.

If you are not sure where to start, start with adding my feed:

Webpage: Canto

Similar software

Google Calendar client for Ubuntu

I was looking for a simple way to integrate my Google Calendar to my desktop. I keep forgetting things and it would help me a lot in quickly adding tasks in Google Calendar and get an SMS 10/15 minutes before the time I have set. But I couldn’t find anything other than bulky solutions like Sunbird, Evolution integration, Rainlendar etc. A few minutes back I found Fogger, a great app which turns any website to a desktop app on Ubuntu. I tried the apps I created for my Gmail and Google Calendar and to say the least I am hugely impressed! God bless the developers; you have saved me a lot of daily pain.

If you are a heavy Google Calendar user, there are many ways to integrate it with your Ubuntu desktop.

I would love to see some settings added for user-level customization like changing fonts. The fonts look different from that in Firefox. Right now it can be done using CSS which is not possible for all users.


  • The best solution now is the quick in-built app creation support that come with Google Chrome. Check here.
  • calendar-Indicator is a handy brand new app with a lot of regular functionality that makes the job pretty easy. It’s a much better alternative to the above and tiny as well. To install on Ubuntu:
    $ sudo add-apt-repository ppa:atareao/atareao
    $ sudo apt-get update
    $ sudo apt-get install calendar-indicator
  • Unity Web Apps
    Comes integrated with the Unity desktop on Ubuntu.
  • gcalcli is another option to use Google Calendar from the cmdline.

Quick Tip

You can just bookmark the Google Calendar mobile page and check your agenda quickly. For fast results you must be logged in to Google.

Some of my favourite Ubuntu utilities

ubuntu_apps_compThere are some excellent applications on Ubuntu which come handy frequently. I have listed some:

  1. Baobab: Graphical disk usage analyzer.
  2. BleachBit: Free up your system by removing temp files, history and other cruft.
  3. eboard: If you play on FICS eboard is indispensable.
  4. FSlint: Remove duplicate files. It can find things like duplicate files, problematic filenames, temporary files, bad symlinks, empty directories and nonstripped binaries.
  5. galculator: A better alternative to the gnome-calculator which still seems buggy/user-unfriendly to me when converting between Hex to Dec etc.
  6. GCstar: A collection manager for almost everything you collect.
  7. gFTP: Tiny multithreaded FTP, FTPS (control connection only), HTTP, HTTPS, SSH and FSP transfer client.
  8. Glipper: A very handy clipboard manager that can remember entries across reboot. It can be accessed using a keyboard shortcut beside your pointer (like right click) and you can choose the copied text.
  9. Gpick: Pick any color from the screen.
  10. GtkOrphan / RpmOrphan: The omnipotent clean-up utility of to get rid of unused libraries, packages etc.
  11. HandBrake: The best video encoder ever written!
  12. Leafpad: A great relief the bloated gedit editor is removable on Ubuntu 12.04. I use the lightweight Leafpad. When I need power, I use vi.
  13. localepurge: remove unnecessary locale files.
  14. Marlin: Lightweight and superfast file manager. To make it faster:
    $ sudo mv /usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd /usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd.bak
  15. nautilus-image-converter: Resize and rotate images from nautilus.
    To customize it, edit:
  16. PCManFM: Ultra-lightweight and fast file manager.
  17. qBittorrent: µTorrent for Linux. Supports torrents, magnets and DHT.
  18. Subtitle Editor: Do anything with movie subtitles.
  19. rar & unrar: Frequently needed to extract downloaded rar files.
  20. wget: A very very powerful cmdline downloader (a good multi-threaded alternative is axel).
    As an example of the power of wget, a whole website can be downloaded using the following command (instead of installing HTTrack):

    $ wget -r -mirror -p -convert-links -P ./mydir URL

    -r: recursive
    -mirror : turn on options suitable for mirroring.
    -p : download all files that are necessary to properly display a given HTML page.
    -convert-links : after the download, convert the links in document for local viewing.
    -P ./mydir : save all the files and directories in ./mydir. To resume a partial downloads (if server supports), run the following command in the same directory:

    $ wget -c file_URL
  21. xpad: A tiny sticky notes application. (#9a99ff is my preferred bg colour)

I used to use wine 3 years back to run some Windows applications but Google helped me find much better alternatives for all my needs on Ubuntu.