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.



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