MEDOIX

technology, life & solutions

Remove Old Kernels in Ubuntu

by medoix on November 5, 2012, no comments

To get started, open Terminal. When it opens, run the commands below to view your current running kernel.

old_kernel_oneiric

Next, take notes of your current kernel. DO NOT REMOVE THIS!

old_kernel_oneiric_1

Next, type the command below to view / list all installed kernels on your system.

old_kernel_oneiric_5

Next, find all the kernels that which number are lower than your current kernel.  When you know which kernel to remove, continue below to remove it.

old_kernel_oneiric_2

Finally, run the commands below to remove the kernel you selected.

old_kernel_oneiric_6

When you’re done, run the commands below to update grub2

old_kernel_oneiric_7

That’s all.

Stop OS X Terminal SSH Timeout

by medoix on February 24, 2012, no comments

There are three ways to do this using the ServerAliveInterval to send data along every few seconds. Replace the “10″ with the number of seconds between pings.

From least to most global:

1. Add the option on the command line:

2. Add the option to your personal ssh config by creating/editing ~/.ssh/config:

3. Add the option to the system-wide ssh config by editing /etc/ssh_config. (Syntax the same as above.)

Change MySQL Database Location

by medoix on February 19, 2012, no comments

So considering that i am using a 8GB USB Stick as my OS HDD it tends to get full easily and i need to clean stuff up or move things around. This happened recently with my fairly large databases.

Also because of read/write cycles are high i couldn’t imagine this would be good for my flash drive HDD and therefore decided to move it!

 

Stop MySQL

Move existing data directory (which is located in /var/lib/mysql) to new dir /usr/new_datadir

Create symlink from new dir to old one

Don’t change /etc/mysql/my.cnf

Ubuntu uses some security software called AppArmor that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you’ll never be able to restart MySQL with the new datadir location.

In the terminal, enter the command

Duplicate the lines beginning with /var/lib/mysql and replace duplicated strings with /usr/new_datadir

In my case it was:

Restart the AppArmor profiles

Restart MySQL

MySQL should now start without any errors, have fun!

Get external (WAN) IP address from command line in Linux

by medoix on February 3, 2012, no comments

Many services and applications require you to know your external (WAN) IP address. There are plenty of web sites that allow you to do this, but here are a couple of simple ways to do this from the command line in Linux.

The first method uses the cURL utility, which is basically a command-line utility for retrieving data using URL syntax. In Ubuntu or Debian, you can install cURL from the repositories using the command:

After installing cURL, just run this command to get your external IP address:

You can replace ifconfig.me with other service hostnames/URLs, such as:
whatismyip.org
icanhazip.com
tnx.nl/ip
myip.dnsomatic.com
ip.appspot.com
checkip.dyndns.org:8245
whatismyip.com
jsonip.com

The second method is really a variation on the one above and uses the wget command. You can use the same hostnames/URLs as above with this command:

Have fun! And let me know your tips for this in the comments.

Tor Hidden Service on Ubuntu

by medoix on January 28, 2012, one comment

NOTE: This article does not explain how to setup apache or any other services apart from the tor application for hidden_service.

I have recently been migrating all of my browsing, email and communications etc through the Tor Network.

One of the cool features of the onion router is the ability to setup what is referred to as a hidden service. This is just what it sounds like, a domain (16characters.onion) randomly generated and completely anonymous through the Tor network can be configured to point to a local service port. (Apache, SSH, SMTP etc)

To do this on my Ubuntu server all i had to do was the following…

Now that tor is installed we can create the hidden_service folder.

This folder is where the private_key and hostname files will be created and stored.

We now want to add our hidden_service to our torrc file (tor config file).

And un-comment the following lines (remove the # from the start of each line)

The above two lines tell tor where to store the files as mentioned above and also what service you want to map to. In my case port 80 (Apache Web Server) and it is running on the local server (127.0.0.1)

CTRL+X to quit nano and hit Y to save the file.

Now we want to reboot the tor service so it can pick up the new settings and generate our hostname.

Tor will restart and the private_key and hostname files will be generated in the folder as above. You can now open your hostname folder to retrieve your 16character.onion domain name and put it to good use.

Backup Bitcoin Wallet to Dropbox OSX

by medoix on January 28, 2012, no comments

So i have my Bitcoin application running and as the latest version now supports wallet encryption i have this turned on with a long password.

I was looking for a way to backup my wallet in case i need to format my machine or things go south.

First quit the Bitcoin application and then move the wallet.dat file from the Bitcoin folder located at “~/Library/Application Support/Bitcoin” and put it in your Dropbox folder as below.

Secondly i now needed to create a link from the location that the Bitcoin application looks at to where the wallet file now resides.

Now start the Bitcoin application and your address’s should all be there and correct.

Disable Translation Packages in Ubuntu

by medoix on January 22, 2012, no comments

To disable downloading translations, create a file named /etc/apt/apt.conf.d/99translations & put the following in it:

You may also need to remove existing translation files in /var/lib/apt/lists/
I personally just empty the lists folder and do an apt-get update

Mac OS X Lion – Remove “All My Files” from Finder

by medoix on January 18, 2012, no comments

Finder on Mac OS X Lion by default is always showing “All My Files” on every new window. Well to be honest not even once I found it useful, never used it since the first install.

Even if you are a geeky Terminal fan, there are always times that you start up Finder, and you need to get faster to your important files. Most of the times I am looking for something in the Documents folder/subfolders, so here is how I have set it as the default Finder directory:

Go to Finder, main menu -> Finder -> Preferences… -> General -> and select your favorite folder in “New Finder windows show” option as shown in the screenshot below.

Set Default Finder Open

You can also remove “All My Files” from the Finder’s sidebar as well, just right-click and remove it, or uncheck it from Preferences -> Sidebar.

Pop-Up Notifications To iTunes

by medoix on November 24, 2011, no comments

Mac: Usually, if you want to find out what’s playing in iTunes, you either need to right-click the icon or open it. Macworld found a method that only requires a little work in Terminal to enable a small pop-up on your dock showing the currently-playing track.The process is simple, but only works in OS X Lion. First, boot up Terminal in your Utilities folder on a Mac, then, type:

Now, when you’re playing a track a small pop-up will show in your dock for a few seconds with information on the currently-playing track. If you decide you don’t like it, disabling it is simple. Back in Terminal, type:

For ways to customise the pop-up, hit up the post linked below.

Enable VNC/Management on OSX by SSH

by medoix on November 24, 2011, one comment

I had the VNC based remote access feature of OS X enabled on 10.7 but somehow it got switched off.  I fiddled around a bit and figured out how to enable remote access from a remote SSH shell.  Note that these instructions will lead to manual configuration and you will not be able to enable/disabled the services from the System Preferences anymore.  In my case I used this to get in when I needed to but latter switched it back off and used the System Preferences setting.To manual switch on remote access from the terminal:
To switch this override back off and thus allow the System Preferences to manage screen sharing again run the following. (This will disconnect any active sessions and require physical access to re-enable it.)