Android Tweaking Demystified [Part-II] “init.d Scripts”

It has been quite some time since I last posted some mouth-watering set of tweaks in the previous edition of “Android Tweaking Demystified” series which I am quite sure you all must have tried your hands on. After having enjoyed some basic level tweaks, here are a set of advanced ones for the risk takers. They require a bit of preparation.

This set is dedicated to the init.d tweaks. The very obvious question that might pop in your minds and you may ask what init.d means? Well, answering this question needs some background of the android basics. Android is heavily based on linux with properties resembling as that of the linux. Without getting into the technicalities of linux programming and stuff let me discuss the relevant information of the init.d directory.

The init.d directory has a specific job. It ultimately does one thing but it does that one thing for your entire system, so init.d is very important. The init.d directory contains a number of start/stop scripts for various services on your system.

In order to control any of the scripts in init.d manually you have to have root (or pseudo) access. Each script will be run as a command and the structure of the command will look like:

/etc/init.d/command OPTION


  1. Rooted device.
  2. Rom with init.d directory access.
  3. Es File Explorer
  4. Busybox

Install the Root explorer and the Busybox on your device. Navigate to root directory of your phone via the Root explorer.

For a guide on how to use the Root explorer refer to my previous post.

Now, open empty file, insert header #!/system/bin/sh and put these there, save in /system/etc/init.d and name it something like “77tweaks”.

Internet speed tweaks

echo “0” > /proc/sys/net/ipv4/tcp_timestamps;

echo “1” > /proc/sys/net/ipv4/tcp_tw_reuse;

echo “1” > /proc/sys/net/ipv4/tcp_sack;

echo “1” > /proc/sys/net/ipv4/tcp_tw_recycle;

echo “1” > /proc/sys/net/ipv4/tcp_window_scaling;

echo “5” > /proc/sys/net/ipv4/tcp_keepalive_probes;

echo “30” > /proc/sys/net/ipv4/tcp_keepalive_intvl;

echo “30” > /proc/sys/net/ipv4/tcp_fin_timeout;

echo “404480” > /proc/sys/net/core/wmem_max;

echo “404480” > /proc/sys/net/core/rmem_max;

echo “256960” > /proc/sys/net/core/rmem_default;

echo “256960” > /proc/sys/net/core/wmem_default;

echo “4096,16384,404480” > /proc/sys/net/ipv4/tcp_wmem;

echo “4096,87380,404480” > /proc/sys/net/ipv4/tcp_rmem;

Virtual memory management tweaks

echo “4096” > /proc/sys/vm/min_free_kbytes

echo “0” > /proc/sys/vm/oom_kill_allocating_task;

echo “0” > /proc/sys/vm/panic_on_oom;

echo “0” > /proc/sys/vm/laptop_mode;

echo “0” > /proc/sys/vm/swappiness

echo “50” > /proc/sys/vm/vfs_cache_pressure

echo “90” > /proc/sys/vm/dirty_ratio

echo “70” > /proc/sys/vm/dirty_background_ratio

Miscellaneous kernel tweaks

echo “8” > /proc/sys/vm/page-cluster;

echo “64000” > /proc/sys/kernel/msgmni;

echo “64000” > /proc/sys/kernel/msgmax;

echo “10” > /proc/sys/fs/lease-break-time;

echo “500,512000,64,2048” > /proc/sys/kernel/sem;

Battery Tweaks

echo “500” > /proc/sys/vm/dirty_expire_centisecs

echo “1000” > /proc/sys/vm/dirty_writeback_centisecs

Strict minfree handler tweak

echo “2048,3072,6144,15360,17920,20480” > /sys/module/lowmemorykiller/parameters/minfree

 Please leave your useful comments below. I’ll try my best to resolve the issues, if any.

Disclaimer: Blogtechnika cannot be held responsible for any damages to your device. Perform these tweaks at your own risk.

2 Responses

  1. I was just wondering if you could explain these tweaks a little bit more. And if we remove this 77tweaks file, do these changes get un-done at boot? And don’t you have to change the permissions on the file after creating it so that it has execute permission?
    also, should it be:
    echo “64000? > /proc/sys/kernel/msgmin;
    echo “64000? > /proc/sys/kernel/msgmni;

  2. Ditto the prior comment. Thank you for posting this information, but I have absolutely no idea what any of them actually do. I looked at your prior article on build.prop changes, and have the same problem.

    For example:

    echo “500? > /proc/sys/vm/dirty_expire_centisecs

    What does “dirty_expire_centisecs” do in the system, and what is the default value? What is the impact of changing it to 500? I’m sure the defaults were selected for a reason, so what’s the disadvantage of changing it?

    The same question can be asked about every single instruction in this, and your prior, article. Without this kind of information, I don’t know why I might want to change a value, nor what benefit and cost I will get by changing it.

Leave a Reply

Your email address will not be published. Required fields are marked *