To use your iPhone's internet connection through a Linux notebook over bluetooth, you have to open Tethering option on your iPhone device, under the Settings->General->Network section.

After that you can install blueman for easily configuring bluetooth PAN network:

apt-get install blueman

Start blueman-manager and find your mobile device and connect to it. When connection completed successfully, select Device->Add->Network Access Point in blueman-manager.

And the last step, configure the network interface:

dhclient bnep


Sometimes it is hard to use external usb card with amarok if it is not selected as default. In order to configure amarok to use usb sound card, you must learn the name of your usb sound card first with:

cat /proc/asound/cards
0 [Intel          ]: HDA-Intel - HDA Intel
1 [U0x41e0x30d3   ]: USB-Audio - USB Device 0x41e:0x30d3

After that, just open the amarok settings window -> engine settings and checked output that if alsa is selected, if not select alsa first.  And enter your soundcard's name with a prefix of  plughw: as below:


save the settings and play another file, it should work.


This is a simple Ruby script example which covers a multi-conditional find and replace mechanism. In this script, I'll tried to clear files which are infected by todays popular ftp trojans (Trojan runs on windows clients, grabs ftp login informations, send it to a central server and afterwards it connects to your ftp server from thousands of different IP addresses to inject malicious javascript and iframe codes)


We want to remove <iframe ...></iframe> codes which goes to a unwanted address. We also want to remove infected javascript codes. But, they're different kinds of this trojan, and it's changing itself. A simple search/replace operation is not enough, sometimes infected code can be like this:

<ScRipT language="Javascript">.....</Script

or like that. So I want to use a HTML/XML parser to be sure that script tag and contents cleared properly.

I used Nokogiri Ruby gem for XML parsing, it is a fast library and required libxml2-dev. You have to use libxml2 version >= 2.7.3 otherwise you may be encounter some encoding problems. If you already have ruby and gem package, here instructions:

apt-get install libxslt1-dev libxml2-dev
gem install nokogiri

read more

IPv6 still couldn't find any role in industry. So, it is good to completely disable this functionality in kernel. You can do this with building a custom kerne. But, most of the systems uses generic kernels which comes with the distribution itself. In order to disable ipv6 support, create a new file named 000-local under /etc/modprobe.d directory and puts following two lines:

alias net-pf-10 off
alias ipv6 off

After that, restart your system and ipv6 just gone away.


NOTE: If you have a distribution that ipv6 support compiled into main kernel not built as module you still disable ipv6 through proc interface, or adding following line into /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1


If you want to convert a .wav file to a .mp3 file, you can use lame command-line tool.

To install lame:

sudo apt-get install lame

lame input.wav input.mp3

lame can be used to convert .wav files to .mp3 files and .mp3 files to .mp3 files too. Different bit-rates can be specified.

For example, if you want to convert your .mp3 file from 128kbps to 64kbps:

lame --mp3input -b 64 input.mp3

If output file name doesn't specified, lame gave it the input file's name.

--mp3input parameter specifies that input file is a .mp3 file.

If you can't choose a mirror to use with apt, you can use netselect-apt tool.

netselect-apt downloads the full mirror list from Debian's web site and uses the netselect to choose the fastest one. netselect is an implementation of "ping", but it is smarter than "ping".


netselect-apt finds the best mirror and writes a sources.list file that can be used with apt.

To install this tool:

apt-get install netselect-apt

netselect will also be installed, because netselect-apt depends on it.

You can specify which distribution to use, the default is "stable".

netselect-apt testing

You can include non-free section:

netselect-apt -n

You can use ftp mirrors instead of http:

netselect-apt -f

Sometimes it is very annoying to wait ten's of seconds to finish remote ssh server's reverse dns lookup procedure. It can be disabled on the server side but this process has a few tricks.

First of all, you can make "UseDNS no" in /etc/ssh/sshd_config file, default answer is yes and if this line not shown in your config file, just add it to as below:

UseDNS no

This directive tells sshd process to check resolved host name for the connected client's ip address maps back to the very same ip address or not.


However, it does not prevent the sshd server from performing any DNS lookups at all. That's not the purpose of that directive.


In order to remove dns lookups completely, you have to use -u0 options when starting sshd server. You can easily add this options to /etc/default/ssh or /etc/sysconfig/sshd or elsewhere suitable for your distribution.


-u0 option's means that it will not put hostnames into the utmp structure (i.e. what you see when you type "who" at the shell prompt), which means that sshd will not perform DNS lookups for that purpose. However there are still cases where a lookup has to be performed when a user has




like entries in his authorized_keys file, or when authentication methods or configuration directives are used that involve hostnames.

If you changed your server's ip address and all the configurations of services (apache, dns etc.) you can think about that new requests always comes to your new ip address but it doesn't. Due to the non-sdandard dns caching issues, some of the users still try to connect your old ip address. If you have both of the old ip and new ip working and configured on your server, you can get that connections. But some services can be rely on the specific ip (for example if all the virtual hosts in apache configured for new ip address) to work correctly.

To solve this problem, we can use iptable's NETMAP target to rewrite destination address of incoming packets. This should be done in PREROUTING chain of nat table as below:

iptables -t nat -A PREROUTING -p tcp -d OLD_IP --dport 80 -j NETMAP --to NEW_IP

Above example change all of the destination ip address to NEW_IP on icoming request which is a tcp connection, has destination port of 80 and destination ip of OLD_IP


It is possible to delete a file by the it's inode value. To test this, first create a file:

$ cat > '\n\n\n\n\n\n\n'
type some text

To list the inode and display the characters.

$ ls -libt *

To remove by inode. Note the "--" option. This will keep any special characters in the file from being interpreted at "rm" options.

$ find . -inum -exec rm -- '{}' \;

Or to check contents

$ find . -inum -exec cat '{}' \;


You can use ldd command to display all of the libraries which linked against a binary:

ldd /sbin/mkfs =>  (0xb7fad000) => /lib/i686/cmov/ (0xb7e3a000)
  /lib/ (0xb7fae000)

Sometimes, especially on embedded systems other than i386 architecture, there is no ldd utility. If you found this type of system and wants to learn the used libraries for a binary, you can use directly as follow:

/lib/ --list /sbin/mkfs =>  (0xb7fad000) => /lib/i686/cmov/ (0xb7e3a000)
  /lib/ (0xb7fae000)