How To Remove Host From Known_Hosts File – Ubuntu

Wednesday, 5. December 2012

If you ever wanted to update your local server known_hosts file this snippet may be what you just need!

Start your terminal window and whack this script and and press enter.

ssh-keygen -f "/home/account/.ssh/known_hosts" -R IP_ADDRESS_OF_HOST

How To Run Xampp ON 64 bit Machine – Ubuntu

Saturday, 1. December 2012

If you have tried to install and run xampp on a 64 bit machine you will undoubtely come across an error such as this when you launch the contorol panel.

XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system.

The quick solution is to install the ia32-libs library which in general – it allows 32bit apps to run on 64 bit systems.

sudo apt-get install ia32-libs

Smile :)

Error importing pygtk2 and pygtk2-libglade

Saturday, 1. December 2012

If you have been stressing with this type of error

Error importing pygtk2 and pygtk2-libglade

While launching xampp control panel – this snipper maybe of help to you.

Simply install the pygtk2-libglade library and all should hopefull be OK for you. The command you nee is:

sudo apt-get install python-glade2


INSTALLING Oracle Java JDK 7 On Ubuntu 12.04 step by step

Friday, 30. November 2012


1) Download the JDK 7 from:

2) You will download the tar.gz file. Extract it to your preferred location then run this:

— Create a new folder:

sudo mkdir -p /usr/lib/jvm/jdk1.7.0

— Move the content of JDK to your new location

sudo mv <EXTRACTED_FOLDER>/* /usr/lib/jvm/jdk1.7.0/

— Then Run the following lines one at a time

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1 
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

All done!!

Can’t log into ubuntu via graphical login screen after .profile update

Thursday, 8. November 2012

I have had a scenario today after updating the .profile file where I could not log back in to ubuntu via the normal graphical login screen.

It turn out that i left the extra double quote in the .profile file (“) which was causing the error

To correct the mistake you will have to log in via terminal by hitting Ctrl+Alt+F2

Then enter your username as well as the password and navigate to yoour .profile file to make amends.

Finally, Type: sudo reboot to reboot your machine and this time you will be able to log in normally via graphical login screen.

Same scenario may happen if you edit .bashrc file as well.

Crtl + ALT + F2

Show Delete Shared Folder resources On Ubuntu/Linux System

Tuesday, 23. October 2012

A little snippet to show and delete currently shared folders or resources on Ubuntu / Linux machine.

Show Shared folders / resources

net usershare info

Delete Shared folders / resources

net usershare delete <share_name>


Add Non Sudoer Account to the Sudoer User Group

Sunday, 29. July 2012

If you ever wanted to add a new non-sudoer account to sudoer group, here is the simple steps to help you achieve just that.

Log in to your server/machine as root.

Navigate and open the sudoers file

nano /etc/sudoers #Use your preferred editor
sudo visudo #Better as it checks for syntax errors.

Once the file is opened, navigate to the bottom of the file until you find the line like this below..

## Allow root to run any commands anywhere
root    ALL=(ALL)	ALL

Underneath this last line, add the account details you want make sudoer

useraccount ALL=(ALL)	NOPASSWD:ALL

This simply allows the new account to use/call the sudo commands without having to type the password.

Save the file, and restart your terminal session again.

Some time you may have to delete the following entry in order to make things working.. do this if the first steps still gives you the same error.

Scroll right at the bottom and look for this line:

#includedir /etc/sudoers.d

Remove it! Restart session and you should be OK!


Grep – Exclude multiple directories and files while using grep search

Thursday, 14. June 2012

Here is a good example of how to list files matching a certain pattern while exclude grep from performing search on multiple folders and files

Files Matching search term excluding multiple directories and files with grep

grep 'open source' -R . -il --exclude-dir={var,js,downloader,media} --exclude=*.{png,jpg,gif} --color

Using grep to search for a text within files recursively

Thursday, 14. June 2012

To search for text in files from the current folder recursively. you can :

grep text_to_search -R . -n --include=*.php --color

The parameters are as follows:

the actual text to search for

Recurse to subdirectories

start from the current directory

specifies a regular expression that searchable files must match (in my case, search only files with the ‘php’ extension)

makes the output pretty

shows the lines numbers of the lines that matched your search text

List subdomains on the server via command line tool – cPanel

Sunday, 10. June 2012

If you want to quickly list all sub-domains on your server via command line tool this script may help you. It assume you have cPanel installed on the server.

/usr/local/cpanel/scripts/listsubdomains <USER_ACCOUNT>