Sensible plugin for Vim

Sensible is a super simple plugin for Vim by Tim Pope. It is nothing but a set of sensible settings for your vimrc. It is a great way to start off on a new system where you do not have access to your fully featured vimrc. I only wish he explained some of the choices he made for the options in this file.

If I have a local account on the remote or new computer, I find it far easier to just replicate my vimrc, and other dot files, using GNU Stow.

Selenium error on geckodriver


I updated Ubuntu packages, which included Firefox and I updated Selenium using pip3 cause that also depends on the Firefox version. But running my existing Python scripts that use Selenium popped this error:

FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'


Firefox now provides the geckodriver as a separate binary. You can download the version matching your OS and CPU here. Unzip the file and place the binary anywhere that is in your PATH. Your Python scripts should work now.


Tried with: Firefox 49, Selenium 3.0.1 and Ubuntu 16.04

Trailing slash in symbolic link

I recently noticed something strange when creating a symbolic link to a directory:

$ ln -s foo_dir/ slink_to_dir
$ ls -l
drwxrwxr-x 2 ashwin ashwin 4.0K 2016-10-05 21:37 foo_dir/
lrwxrwxrwx 1 ashwin ashwin    7 2016-10-10 21:47 slink_to_dir -> foo_dir//

Notice the double slash (one extra slash) in the destination of the symbolic link.

In fact, you can add multiple slashes and they all show up with one extra slash:

$ ln -s foo_dir/// slink_to_dir
$ ls -l
drwxrwxr-x 2 ashwin ashwin 4.0K 2016-10-05 21:37 foo_dir/
lrwxrwxrwx 1 ashwin ashwin    7 2016-10-10 21:47 slink_to_dir -> foo_dir////

Turns out that this is the standard working of the ln command. If you are pedantic, you can keep it clean by never specifying a slash when creating a symbolic link using ln:

$ ln -s foo_dir slink_to_dir

Anyway, even if you use the extra slashes they have no effect either since Unix (and Linux) allow and ignore the multiple slashes in a path.

Tried with: Ubuntu 16.04


Choqok is a microblogging client for KDE that supports Twitter and a couple of other microblogging services no one actually uses ( and GNU Social).

  • Installing it from a PPA is easy:
$ sudo add-apt-repository ppa:adilson/experimental
$ sudo apt update
$ sudo apt install choqok
  • Choqok is a very basic Twitter client. It supports multiple Twitter accounts, viewing your timeline, retweeting and tweeting.

  • By default only the latest 20 tweets are shown and new tweets are checked every 10 minutes. This can be increased in the settings.

  • It does autocompletion when typing Twitter handles, not just for folks you follow!

  • It does not show the number of retweets or likes of tweets.

  • Conversations can be viewed by clicking the rightmost up-arrow below the tweet (visible only if it is part of a conversation). The conversation opens in a new window.

Tried with: Choqok 1.5 and Ubuntu 16.04

EmojiOne Picker

I can finally stop complaining about the absence of a emoji picker for Linux. Now there is the EmojiOne Picker! It is a simple picker application based on the awesome emoji set of EmojiOne.

  • Installing from PPA is the easiest way to get it:
$ sudo add-apt-repository ppa:ys/emojione-picker
$ sudo apt update
$ sudo apt install emojione-picker
  • To use just type EmojiOne Picker at the Dash. Note that it takes a few seconds to load and finally settles down in the system tray area with a smiley face. Right-click on it to get the fully detailed list of emoji. Click on any one and it will be copied to your clipboard for easy pasting into any app or website.

  • In Settings, I like to choose the Low end computer mode which reduces the number of emoji and thus makes loading and usage of this app faster.

Tried with: EmojiOne Picker 0.1 and Ubuntu 16.04

How to autocomplete path in Vim insert mode

Vim path autocomplete in insert mode
Vim path autocomplete in insert mode

It is useful to be able to autocomplete a path to a directory or filename while typing code or script files. This helps in ensuring that there are no mistakes and the path is correct. Thankfully, Vim has an autocompletion feature for typing path in insert mode! It calls this feature as file name completion.

  • Ctrl-x Ctrl-f: This is the shortcut to autocomplete path in insert mode. Start typing a path (absolute or relative) and use this keyboard shortcut. You will see a dropdown menu filled with the next entries from the filesystem that can be used to fill the path.

  • Ctrl-n or Ctrl-p: Shortcuts to move up and down the entries in the autocomplete dropdown menu. If you move off the top or bottom of the dropdown menu, you get the empty entry.

  • Absolute path: Any path that you begin typing with a slash is autocompleted as an absolute path.

  • Relative path: This is any path that does not begin with a slash. They are autocompleted too. Note that they will use the directory that Vim was launched from (PWD) as the root.

  • Hidden files or directories: I found that this was autocompleted only if I typed the first period and then used Ctrl-x Ctrl-f.

Tried with: Vim 7.4 and Ubuntu 14.04

How to install and use Git LFS

Large File Storage (LFS) is an extension to Git to handle large files. This is usually used to store binaries or graphics or video game assets.

  • Install: The easiest way is to install a package from the LFS repository:
$ curl -s | sudo bash
$ sudo apt install git-lfs
  • Use: To fetch the files from a remote repository to local repository and checkout a large file:
$ git lfs fetch
$ git lfs checkout foobar.bin

This replaces the foobar.bin which was a placeholder with the actual large file fetched from the remote repository (which should also have LFS support, like Github for example).

Tried with: Git 2.9 and Ubuntu 14.04

Trailing slash in rsync

RSync has some different and confusing behavior depending on whether you put a trailing slash on the source directory or not.

  • No trailing slash on source directory: this copies the source directory itself as a subdirectory into the destination directory.

For example:

$ rsync -a /some/path/foobar .
$ ls
  • Trailing slash on source directory: this copies the contents inside source directory into the destination directory.

For example:

$ rsync -a /some/path/foobar/ .
$ ls

You do not see such confusing behavior with cp or mv. I guess rsync has this because it is usually used for synchronizing the contents of two directories but it is also sometimes used to copy over directories.

Log of sudo commands

I recently discovered that a user on a server had accidentally killed my program. Many users, including me, on this server have sudo permissions. So, I guess the kill was carried out by using sudo. How to find out who is the killer?

Thankfully, all actions taken under sudo are logged in the /var/log/auth.log file. You will find entries of this form:

Sep 26 08:31:26 foobar-machine sudo:   joe : TTY=pts/1 ; PWD=/home/joe/scripts ; USER=root ; COMMAND=/usr/sbin/openvpn --daemon --config foobar.ovpn
Sep 26 08:31:26 foobar-machine sudo: pam_unix(sudo:session): session opened for user root by joe(uid=0)
Sep 26 08:31:27 foobar-machine sudo: pam_unix(sudo:session): session closed for user root

You can see that all pertinent information is available in the log: who ran the command, what command and when.

Tried with: Ubuntu 16.04

How to find if disk is SSD or HDD

Disk IO can be the bottleneck for certain programs. When I work with such programs on remote servers, I prefer to place their data or direct their output to SSD instead of HDD. I can view the available partitions and their filesystems using the df command. But, how to find out which of the mounted partitions is on a SSD and which on HDD?

You probably know that the disk of a partition listed as /dev/sdb7 is /dev/sdb. That is, by removing the numerical suffix from the partition, you get the disk.

To find out if the disk is SSD or HDD, check the /sys pseudo filesystem using the disk name:

$ cat /sys/block/sdb/queue/rotational

If it is HDD, and thus a rotational disk, the value will be 1. For SSD, the value will be 0.

Tried with: Ubuntu 14.04