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.

Courtesy:

http://markmcb.com/2013/02/04/cleanup-unused-linux-kernels-in-ubuntu/

https://ubuntugenius.wordpress.com/2011/01/08/ubuntu-cleanup-how-to-remove-all-unused-linux-kernel-headers-images-and-modules/

The “HOW” of Google Summer of Code

This article is dedicated to all my friends / aspirants who aspire to be GSoCcers (those who get selected for GSoC (an acronym for Google Summer of Code)). I decided to blog as I thought a lot of people needed to be enlightened. So for your benign information, I had been selected for GSoC 2014 under BRL-CAD ( the U.S. Army Ballistic Research Laboratory (BRL) – now the United States Army Research Laboratory ). So I would like to take the privilege to share my experience which might help you to get selected for GSoC. First of all I would like to mitigate the level of apprehension that getting selected in GSoC is neither a Herculean task nor a rocket science . It’s just a few steps of the ladder that you have to climb consequently and patiently.
Alright to be specific, first of all you have to find your skills / interests. Skills can be like having a good acquaintance with C / C++, PHP etc. and interests can be like Web Development, Desktop Application Development, Cyber Security etc.
Okay now that you have recognized your skills and interests we have to see for the organizations which are compatible with your skills and interests. Organizations or communities are the groups which work on certain projects. Mozilla, Linux Kernel, WordPress etc. are the examples of organizations. Then you have to find the organizations or communities under GSoC which work with such projects. You may find them either by googling. However I would recommend to use some other search engines too like https://duckduckgo.com/ , bing etc. 
or using the search filters in this link.
Suppose I know C++ so I would have filled C++ in the “tags” filter (but you have to login to your google / gmail account) and the organizations will appear which work in this technology. You might have seen BRL-CAD organization (I chose this last year) after searching for C++.
Let’s climb the next step. You have to join the community you have chosen. You may do this by subscribing their mailing lists (Search for Mailing List of BRL-CAD or any other organization you want to participate in). Introduce yourself, your skill-set and your intended area of work in the mailing list (just compose a mail and send it off). Also join the community on its IRC channel (Again you have to shed off your habit of spoon feeding and search for IRC (Internet relay chat). :)). However if still you need help peep here. :P
After joining the community on their IRC channel you may start interacting with them that you want to work with their community. It’s better if you ask them something specific that you want to work on a specific project rather than asking “What project should I work on?”. Do a plenty of homework before interacting with the community; homework in the sense, see what were the previous years’ projects etc. However don’t hesitate to interact as they all are more than happy to help. :)
Next step is to choose the project you wish to work under that community. Most of the times it is suggested by the community however students can also propose some project if they have something good in mind that can help the community.
Then brace yourself up and start shooting the bugs down in the project you have selected. Solve the bugs and submit them in the form of patches (patches mean small improvements in the existing code). This is the most crucial thing that will be counted perhaps because this shows both your capability and devotion.
And the last step you have to climb is writing up a proposal of the project you wish to do in GSoC and submit it when application process starts. The proposal should include all the details like how you fragment the complete project and spread it over a time scale of 3 months. However, a format will be given for writing the proposal. Decide your targets / milestones that you will achieve while coding. Now you are almost done, just recite a few hymns to praise the God or rely on your luck till you get selected. (y)
To keep a track of what is going on, see the following website. You may see timeline of events which have occurred or which are yet to occur. This the most useful asset. :D
I wrote this post because I was also guided. :) Keep contributing in open source. It’s fun and it’s awesome. :D
For further queries you may ask (just leave a comment), I will try to help. :)

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

http://www.grymoire.com/Unix/Sed.html#uh-0 .

Solution:

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! :D

namechange

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. :P 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. :Pdata1

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. :P

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.

Installation:

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

$ sudo apt-get install quassel

Uninstallation:

$ 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. :D 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/install-css.sh

ENgulfing the tech

So as usual these days I am trying to engulf as much tech knowledge as I can. After HTML, CSS, PHP, it’s the time of JavaScript to be engulfed. Codecademy.com is really cool. I am in love with the way it tutors. Apart from this, I am thinking of  implementing this knowledge to make some productive project which will be of some use.

I am also trying my hands upon SQL injection, Cross Site Scripting (XSS), MD5 encryption and one more thing which is really cool but for now let it be a secret. ;-) I will try to write the tutorials of each of the above once I do some considerable amount of work on these. But for now I have to leave because I don’t want to skip my breakfast in the hostel mess like the past few days. :P