Nov 28, 2017

Linux date command

The date command is mostly used to get the current date. But there are some underappreciated gems of feature in this command.

Get a date in the past

> date -d "3 days ago"
> date -...
May 29, 2017

Linux Tree Command

The tree command list contents of directories in a tree-like format. I often use this to document directory structures of my projects. The output of tree is of course, the directory structure drawn in an ASCII art style tree. See example below. A few lines of comment are added to inform team ...

Jul 1, 2016

Find large files in a given directory

A linux command called du is used to display disk usage statistics. By default it shows all the files and subdirectories (recursively) residing under the current directory. For example:

> du -h
4.0K    ./node_modules/.bin
256K    ./node_modules/nlp_compromise/client_side/basic_...
Jan 19, 2016

Calling C functions in Python scripts

Python is an extensible language. Code written in compiled languages like C can be invoked from Python with a little effort. This allows software developers to write simple human readable scripts in Python to make use of faster libraries written in compiled languages.

Say, we have the followin...

Jan 14, 2016

Creating GIF animation in Ubuntu

From the manual of 'convert'

The convert program is a member of the ImageMagick(1) suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

The above quoted paragraph is an understat...

Dec 24, 2015

Don't sudo pip install in virtual environments

Deploying python projects in virutal environemnts is a fairly standard practice. Such a deployment process could include a step to install all required python modules from a requirement file like so:

(your_virtual_env)> pip install -r requirements.txt

Does it seem a bit odd that we didn't ...

Apr 10, 2014

How to diff binary files

We can use diff to compare to text files, but it doesn't work very well for binary files. Let’s say two images a.png and b.png needs to be compared. Simply using diff doesn’t take us far.

> diff a.png b.png
Binary files a.png and b.png differ

A command to produce hexdump, xxd for exam...

Mar 2, 2014


The xargs command breaks down the data from standard input into parts small enough to be fed into an unix command that takes input from the argument list only.

Some unix commands can take input from standard input, e.g., grep , and ls. Then there are other commands that take input from t...