Category Archives: Ubuntu

Compress a directory in Linux

The tar command in Linux is used to compress or create an archive of a directory with .tar.gz or .tgz archive files,  they are also called “tarballs”.

Here tar is creating a archive named “archive-file-name.tar.gz” of “source-directory-name”.


-z = Compress the archive with gzip

-c = Creates a new .tar archive file

-v = Verbose, show .tar file progress

-f = Archive File name

Exclude particular directory or file 

To exclude a file or directory from being added in the archive use –exclude option

Compress multiple directories in single archive

You can add any no of directories or files you want to achive

How to Extract Archive

As you can see the only difference between creating an archive and extracting an archive is -x switch replace -c switch.

Useful Linux commands for beginners

If you are switching from Windows to Linux based operating system, then it might be difficult in early days to get hang of it. Here are some commands that will be useful.

  1. If you want to find out size of current directory, just type

2. Check your disk usage

3. See all files and directory size in current path

4. Truncate log files

5. List content of a directory using ls command

6. If you want to know about a command, you can take of man command, for example if you want to go into details of ls command, just type

It will give you an output something similar to this


I will be updating this with more useful commands as and when I found.


Install Mcrypt PHP extension on Ubuntu (PHP-FPM + Nginx)

To install Mcrypt PHP extension on Ubuntu / Debian run following command ( this step is same for Nginx and apache )

This will create a mcrypt module in /etc/php5/mods-available directory. If it doesnt we need to create symlink for this.

Now enable mcrypt by running

After this restart php5-fpm service by


Enable password authentication and set root password – Ubuntu

To enable Password Authentication

Open file etc/ssh/sshd_config by

Search for PasswordAuthentication no, just change this to

To set root password

it will ask for new root password and confirm root password. To test this logout from current session and try to login using root as user and password that you have just assigned.


How to update Geary to latest version

Geary is an IMAP mail client for GNOME 3.

Geary recently released their new version 0.10, with various improvements. To update geary to new updated version add Yorba ppa.

Restart geary and you will see an updated version of geary.

Android Studio – Unable to run mksdcard SDK tool

When I was installing Android Studio on Ubuntu this error occurred which halted the installation

It happened twice and I thought sharing this might help others. It got resolved by running following command.



JDK Required: ‘tools.jar’ seems to be not in Studio classpath

I was installing android studio on ubuntu and come across this error.

After lots of searching I found this simple soutuion that worked for me.

This is caused by having JAVA JRE installed as opposed to JAVA JDK. Installing JDK resolve the problem.


Android – Command not found (Ubuntu)

If you encounter this error, it indicates that your environment variables are not properly set. We will add these environment variables by editing “.profile” file present in your home directory.

If you have installed android sdk through Android Studio, it is likely to be present in /home/your_user_name/Android/sdk, otherwise in /home/your_user_name/android-sdk-linux.

If you have installed it through android studio then add following line in your “.profile” file
export ANDROID_HOME=$HOME/your_user_name/Android/sdk

else add this

$ export ANDROID_HOME=~/android-sdk-linux

Then add the paths to the platform-tools and tools sub-directories

export PATH=$ANDROID_HOME/platform-tools:$PATH

You should now be able to run android from the shell. Note that you might need to reopen the terminal to make it work

Installing node js on Ubuntu using NVM

Node JS can be installed using various methods, but in this post I am going to show you how to install it using NVM (Node Version Manager)

To install NVM through curl

curl -o- | bash

or Wget:

wget -qO- | bash

The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc or ~/.profile).

After this restart PC / VPS to make command NVM available. You will get list of options when you type NVM in your terminal.

Now you can run

nvm install version_name

at the time of writing, latest version of nodejs is 0.12.3. So this can be

nvm install 0.12.3

dev@devenubuntu:~$ nvm install 0.12.3
######################################################################## 100.0%
Now using node v0.12.3 (npm v2.9.1)

You can verify the installation by running

dev@devenubuntu:~$ node -v

Ubuntu – what to do when everything freezes?

(this post is just for a personal reference)
If it locks up completely, you can REISUB it, which is a safer alternative to just cold rebooting the computer.


While holding Alt and the SysReq (Print Screen) keys, type REISUB.

R: Switch to XLATE mode
E: Send Terminate signal to all processes except for init
I: Send Kill signal to all processes except for init
S: Sync all mounted file-systems
U: Remount file-systems as read-only
B: Reboot
REISUB is BUSIER backwards, as in “The System is busier than it should be”, if you need to remember it. Or mnemonically – R eboot; E ven; I f; S ystem; U tterly; B roken.

In case you like mnemonics: Raising Elephants Is So Utterly Boring, or Reboot Event If System Utterly Broken. I’ve also seen it as RSEIUB (Raising Skinny Elephants is Utterly Boring)