Increase port range available for applications in Linux.

By default an average Linux distribution allows applications to use the following TCP port range for outgoing connections: 32,786-65,536. That’s why your system can handle up to 28,232 TCP sessions at time. Notice, this is more than enough if your Linux system is installed on the laptop or desktop and you just use it for occasional visits to yahoo.com, google.com. But if you run proxy like squid or some other services which open a lot of outgoing TCP connections you will likely hit ceiling of 28,232 soon.

First of all, let’s see current port range available for TCP sessions:

cat /proc/sys/net/ipv4/ip_local_port_range

Most likely the output will show something like this one “32786 65536″. In order to expand this range you can either echo modified range into above file in /proc filesystem (temporary solution) or add corresponding line into /etc/sysctl.conf (constant solution).

To temporarily expand port range from 28,232 to 40,000 do the following:

root# echo "24000 64000" > /proc/sys/net/ipv4/ip_local_port_range

To make sure new port range will be applied after reboot add the following line to /etc/sysctl.conf:

net.ipv4.ip_local_port_range="24000 64000"

or just execute this:

root# sysctl -n net.ipv4.ip_local_port_range="24000 64000"

How to wireless in Linux box.

Quick description of how to do it:

cat /etc/wpa_supplicant/wpa_supplicant.conf


network={
ssid="name_of_a_wireless_network"
key_mgmt=WPA-PSK
psk="password_to_a_wireless_network"
}

next step:

cat /etc/network/interfaces


#if your wireless card is wlan0, otherwise change to the right wireless card.
allow-hotplug wlan0
iface wlan0 inet static
address your_ip
netmask your_mask
gateway your_gateway
dns-nameservers your_dns
pre-up wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
post-down killall -q wpa_supplicant

Why that ? because it works on all linux distributions.

Listen online Irish/any radio station.

A few things what we have to do to listen the radio in linux console.

1. Get the radio stream from website:

wget http://dynamic.rte.ie/av/live/radio/radio1.smil

2. After that find the stream:

user@zeus:~$egrep "rtsp|mms" radio1.smil

Some of radio stations broadcasts the stream by rtsp, some of them uses mms, but what’s sure one of them must be there.

If you know the stream of your favorite station, just write:

user@zeus:~$ mplayer rtsp://live2.rte.ie/redundant/1516.ra

Turn off periodic FSCK at booting time.

Forces drives to be checked once for every 30 times the filesystem is mounted. This means that on an average, once every 30 times you bootup your computer, the filesystem integrity is checked.
To disable filesystem integrity check forever do:

$sudo tune2fs -c -1 `mount | awk '$3 == "/" {print $1}'`

or

$sudo tune2fs -c -1 /dev/yourhdd

but if you don’t want disable filesystem check forever, only for the next bootup, create a file called /fastboot.

$sudo touch /fastboot

will disable filesystem check for the next time you bootup. Since the /fastboot file is removed during bootup, this will disable filesystem check only once – for the one time you bootup after you create the /fastboot file
On the contrary to force a filesystem check the next time you bootup, create a file called /forcefsck by doing

$sudo touch /forcefsck

How to save CPU and life of battery.

apt-get install cpufrequtils

next step:

cpufreq-set -g performance

if have 2 cpu:

cpufreq-set -c1 -g performance

get more information about your cpu by:

cpufreq-info

Which governor to use? Available governors:

* performance (default) — The performance governor is built into the kernel and runs the CPU(s) at maximum clock speed
* cpufreq_ondemand (recommended) — Dynamically increases/decreases the CPU(s) clock speed based on system load
* cpufreq_conservative — Similar to ondemand, but more conservative (clock speed changes are more graceful)
* cpufreq_powersave — Runs the CPU at minimum speed
* cpufreq_userspace — Manually configured clock speeds by user

I use at home “performance” and “powersave” on travel with my laptop.

How do I find text within files in Linux ?

This document is for users looking for information about finding text within one or more files on their computer. One of the easiest methods of locating text contained within a file on a computer running Linux is to use the grep command. Below is a basic example of a command used to locate any file containing the word “linux”.

find / -type f -exec grep -H 'linux' {} ;

Added by the LiNiO long before his died:
try also:
fgrep -rw linux path