Posts tagged ubuntu

Update heap size for Tomcat8 in Linux


If you install Tomcat8 (even tomcat7) via apt you will need to edit the file /etc/default/tomcat8   (or tomcat7) and look for the JAVA_OPTS variable. The Xmx value is there and you can set it as required.

Ubuntu 16.04.1 slows down while idle – kidle processes

Warning: the below might make your CPU run hotter or overheat – use at your own risk!

A new Ubuntu 16.04.1 installation – after short usage the computer slows down and the CPUs are about 50% busy. There are some kidle_inject processes running which take this valuable CPU.

Top shows the following:

 6898 root -51 0 0 0 0 S 47.1 0.0 1:20.16 kidle_inject/5 
 6900 root -51 0 0 0 0 S 47.1 0.0 1:20.38 kidle_inject/7 
 6894 root -51 0 0 0 0 S 41.2 0.0 1:13.55 kidle_inject/1 
 6895 root -51 0 0 0 0 S 41.2 0.0 1:16.90 kidle_inject/2 
 6896 root -51 0 0 0 0 S 41.2 0.0 1:18.28 kidle_inject/3 
 6897 root -51 0 0 0 0 S 41.2 0.0 1:18.64 kidle_inject/4 
 6899 root -51 0 0 0 0 S 41.2 0.0 1:20.02 kidle_inject/6 
 6893 root -51 0 0 0 0 S 29.4 0.0 1:08.23 kidle_inject/0

To stop these processes run the following command – it will disable them only for the current session. I very rarely reboot so I haven’t looked into making it permanent yet.

$ sudo rmmod intel_powerclamp


sed tricks to replace multi blank spaces and tabs with single space

Replace all multi-blankspaces (more than one spaces/tabs) in file with mono-blankspace (one space):

sed 's/[<space>][<tab>][<space>][<tab>]*/ /g' filename

can also be:

 sed 's/[<space>][<tab>][<space>][<tab>]*/ /g' filename > newfilename

note: g in the end means GLOBAL

In the above samples, <space> means ‘ ‘ (empty space) and <tab> means ‘      ‘ (tab key press).

Recover MySQL root password on Linux and Windows

It happens that sometimes (after 2 days 🙂 ) you forget the password for your root user on MySQL, well there are few steps to perform to recover it.

This was performed on version:

$ mysql -V
mysql  Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (x86_64) using readline 6.2

The following steps need to be performed as root user, so either login with it or use sudo.

Step 1:Stop the MySQL service

$ sudo /etc/init.d/mysql stop

Step 2: Start the MySQL server without password

$ sudo mysqld_safe --skip-grant-tables &

Step 3: Connect to the MySQL server using the MySQL client

$ sudo mysql -u root

Step 4: Change the password for the root user

mysql> use mysql;
Database changed
mysql> update user set password=PASSWORD("YOUR_NEW_PASS") where user = 'root';
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit

Step 5: Stop the MySQL server again

$ sudo /etc/init.d/mysql stop

Step 6: Start the MySQL server (normally) and test the new password

$ sudo /etc/init.d/mysql start
$ sudo mysql -u root -p


This should also work on Windows as well, you will just need to use different commands for start/stop of the MySQL deamon.



Enable global keys (hot-keys) in Ubuntu on Asus K53

On Asus K53 most of the hot-keys are not working with the default installation of Ubuntu 11.04 with kernel 2.6.38-8, however there is a package available that will enable them, here are instructions on how to perform that:

sudo apt-get install git  (unless you already have git installed)
git clone git://
cd acpi4asus-dkms 
sudo make install
sudo modprobe asus-nb-wmi   (this command will load the newly installed module)

After every kernel update the above will be erased and you will need to re-do it every time until it is included in a kernel version at a later stage. To make it easier create a .deb package which will be easier to install.

sudo apt-get install debhelper 
cd acpi4asus-dkms 
sudo dpkg -i [newly-created-package].deb
sudo modprobe asus-nb-wmi

Enable full touchpad functionality in Ubuntu

I have laptop Asus K53SV and the touchpad was recognized as a mouse only. All of the features that it offered were just navigating the pointer, no scrolling, no disable when typing etc.

There is a patch available (elantech) which solves this issue and the touchpad is recognized with all (at least some 🙂 ) features.

First, install the dkms (Dynamic Kernel Module Support) package if it is not already installed on your machine:

sudo apt-get install dkms

Then, download the patch:

cd /usr/src/
sudo wget

Unpack the patch:

sudo tar jxvf psmouse-elantech-v6.tar.bz2

Add the patch to the psmouse module:

sudo dkms add -m psmouse -v elantech-v6

Build it:

sudo dkms build -m psmouse -v elantech-v6

Install it:

sudo dkms install -m psmouse -v elantech-v6

For successful installation you should get something like this at the end: DKMS: install Completed.

Now, to load the new module with the patch included, you will need to either reboot your machine or reload the new module by executing the following command:

sudo rmmod psmouse && sudo modprobe psmouse

Now, go to System -> Preferences -> Mouse -> Touchpad and you will see all the settings that are available for the touchpad! 🙂


Hibernate on Ubuntu

If the default hibernate does not work on your Ubuntu installation, try installing the package hibernate.

sudo apt-get install hibernate

To use that script then, you can run it via the terminal

sudo hibernate

or create a shortcut on your panel, right-click and Add To Panel, then select Custom Application Launcher and set it up as follows:

After you click Add, there will be a new icon added to your Panel.

Note: when you run the newly created icon it will ask for a password because you are executing it with sudo.

This is tested on ASUS K53SV with Ubuntu 11.04.

Minimize Audacious to system tray

This feature is not enabled by default, at least in Ubuntu 11.04 with Audacious version 2.4.4. However, there is a plugin which enables this feature, the plugin name is called Status Icon and it is located in Preferences -> Plugins -> General.

After you have enabled the plugin, click on the system tray Audacious icon to hide the program completely.

Go to Top