Remove all unused kernels

As you know, everytime there is an update for the kernel, the new kernel is installed while the old one is not automaticaly uninstalled, after several kernel updates you will find a large list of old kernels in the start grub menu . So if we got no problem with the new installed kernel, we can just delete the old ones as they occupy space which is a wastage of resource.

Well there are multiple ways to find the kernel version:

Print the kernel release with uname:

$ uname -r

Print all the information related to kernel:

$ uname -a

List Linux Kernels with dpkg–debian package manager:

$ sudo dpkg -l | grep linux-headers | grep ii

$ sudo dpkg -l | grep linux-headers | grep ii | awk '{print $3}'

Well following is the magic command which removes unused kernels:

$ dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

There is an extensive use of regular expressions and pipe characters which is very well explained below.


Change the โ€œdevice nameโ€ in System settings in Ubuntu

Do you want to change your device name as shown in System settings (as shown in the screenshot below) ?

Alright, we will change our device name with the all powerful sed commmand. For your information sed is a special editor for modifying files automatically. If you want to write a program to make changes in a file, sed is the tool to use. For more information on how to use sed refer to .


Run the following in your terminal:

sudo sed -i 's/present-host-name/new-host-name/' /etc/hosts
sudo sed -i 's/present-host-name/new-host-name/' /etc/hostname

Now check your present-host-name by cat /etc/hostname or hostname .

EnJoY! ๐Ÿ˜€


Recover / Undelete lost data using TestDisk

Hi people of Earth! Are you really worried / vexed because you have accidentally lost your data / partition on your storage media? Don’t worry, just chill! TestDisk has come to your rescue from planet–Open Source. ๐Ÿ˜› So I (friend of TestDisk) will guide you through the steps how to get help from the alien–TestDisk in getting / recovering your lost data (mind it! TestDisk is really fond of getting admired, so go ahead and don’t forget to admire it;-)).

Okay let’s begin recovering your data. Let’s DELETE the data with our own hands and then we will UNDELETE (recover) it. Don’t worry, in this tutorial we will delete some data from our pendrive (just for experimental purpose) and then will recover it. Alternatively, you don’t need to delete the data if your data is already deleted. ๐Ÿ˜›data1

Step1: Create a log file:

Let’s us DELETE some data from our pendrive. In my case I have two files in my pendrive (one song and one picture). Now go ahead and delete your files either from terminal or graphically (as you prefer). Now let’s call our alien-friend, TestDisk for help, type “Testdisk” in terminal and press Enter. Now it will ask for selecting any one of the three options viz [ Create ], [ Append ], [ No Log ]. For now you may select [No Log]. Create and Append are used for recording the work of TestDisk in a log file.Create a log file
Step2: Select a media:

Now this will show all your partitions and mounted drives (pendrive) or any other storage media which is mounted. Now select the media from which you want to recover the data and >[Proceed] (press Enter).Select a media

Step3: Select the partition table type:

Now select the partition table depending upon how partitioning has been done in your storage media. For simplicity, TestDisk gives a HINT below which may indicate the automatically detected partition table type. In our case it has detected Intel. Select and press Enter.Select the partition table type

Step4: Select Advanced:

Now TestDisk may ask for selecting from options viz [Analyse], [Advanced], [Geometry], [Options], [MBR Code], [Delete] and [Quit]. Out of these select [Advanced] and press Enter.Select Advanced

Step5: Select Undelete:

Now it may ask for selecting from options viz [Type], [Boot], [Undelete], [Image Creation], [Quit]. Select [Undelete] as we want to undelete (recover) our deleted files.Select Undelete

Step6 : Select the files to be Recovered:

Now it will show the deleted files in RED. Now you can select the file with “c” (lowercase) to copy the current file, “a” (lowercase) to select all files and “C” (uppercase) to copy the selected files (you may type capital “C” by pressing shift+c).files to be Recovered

Step7: Select the destination where marked files will be copied:

Now select the destination where marked files will be copied. Use arrows keys. The two dots (..) will take you one directory back. Keep pressing enter until you reach your desired destination. For simplicity we will select destination, Desktop.destination

Step8: Final Move!

Now press “C” (shift+c) to copy the selected files onto your destination (Desktop in our case). Now it will start recovering your deleted files. Now if your data to be recovered is in gigabytes (huge amount) go and get some coffee for yourself and leave TestDisk alone for doing its job. ๐Ÿ˜‰ After the recovery is done it will display “Copy done!” in GREEN. That it! Your data is restored. Cheers! Now keeping press “q” untill you quit.

Final Move!Wait! Don’t forget to admire TestDisk (in the comment section below) as it was mentioned above it’s fond of getting admired. ๐Ÿ˜›

Install IRC chat client, The Quassel in Ubuntu 14.10, Ubuntu 14.04, Ubuntu 12.04

Quassel IRC, or Quassel, is a graphical, distributed, cross-platform IRC client, introduced in 2008.[1] It is released under the GNU General Public License for Linux and Unix-like operating systems, OS X, and Microsoft Windows. Since the release of Kubuntu 9.04 (Jaunty Jackalope) Quassel is Kubuntu’s default IRC client.[2][3] Quassel uses the Qt application framework.

Since it might not be installable via “apt-get” or “software center”, we can add “ppa”, update our local packages repositories and install.


$ sudo add-apt-repository ppa:mamarley/quassel
$ sudo apt-get update

$ sudo apt-get install quassel


$ sudo apt-get remove quassel

Ubuntu Fresh Install: RestrictedFormats?

Have you installed a fresh Ubuntu? If YES! then you might be experiencing a few problems in listening to the music, watching videos and surfing the web as in problems with Flash, Java and so on. Don’t worry just feed your terminal with the following commands and all will be well. ๐Ÿ˜€ This is just because the patent and copyright restrictions (see Ubuntu License Policy) complicate distribution of software to support non-free formats.

For Ubuntu:

sudo apt-get install ubuntu-restricted-extras

For Kubuntu:

sudo apt-get install kubuntu-restricted-extras

For Lubuntu:

sudo apt-get install lubuntu-restricted-extras

For Xubuntu:

sudo apt-get install xubuntu-restricted-extras

To play DVDs, you need to install libdvdcss by entering the following in a terminal:

 sudo /usr/share/doc/libdvdread4/