ubuntu : custom battery notification settings

October 25th, 2014 § 0 comments § permalink

By default in Ubuntu the battery discharge notification was set based on remaining time. The remaining time was never accurate nor even near of prediction which caused sudden shutdown or hibernate while working. The only work around the internet was suggesting was to set the notification for percentage of battery remaining instead of time remaining.

Setting notification for percentage remaining.
Since these settings are in Dconf, we may need dconf-editor to makes this easier. I have explained how to install dconf-editor in Ubuntu : Add applications to system tray blog post.

After installing open the dconf editor and navigate to following path in tree sidebar.

org -> gnome -> settings-demon -> plugins -> power

, or you can try to find “battery” and reach the same.

Then update the following settings,

critical-battery-action : The default action to take when battery is empty. Set the critical-battery-action to hibernate if available.

percentage-action : At what percentage of battery OS should take the default which is set just before. I set it to 5.

percentage-critical : At what percentage of battery you need to get the critical notification. I set it to 10.

percentage-low : At what percentage of battery you need to get the first notification for battery low. I set it to 20.

And finally,

use-time-for-policy : Uncheck the checkbox.

Thats it. you are done. You can either restart the system or logout and login back for the changes to take effect.

Unit next time.

Ubuntu 14.04 systray fix

October 22nd, 2014 § 0 comments § permalink

In Ubuntu 12.04, we need to whitelist application to show in systray, but Ubuntu 14.04 removed the systray whitelist settings from DConf. This caused issues for applications like xchat, parcellite etc.

System Tray

System Tray with Xchat

Even though I found lot of solution while googleing, the only one worked for ubuntu 14.04 is,

sudo apt-add-repository ppa:gurqn/systray-trusty
sudo apt-get update 
sudo apt-get upgrade

If you don’t want to update the whole packages, you can try installing only the following ones,

sudo apt-get install libunity-core-6.0-9 unity unity-services

After installing you need to either logout and login or restart your computer. Now the applications likes xchat can be easily minimized to system tray and open when ever you want.

Ubuntu: Convert video to audio in CLI

October 5th, 2014 § 0 comments § permalink

Converting a video on Ubuntu is pretty easy with avconv. If you don’t have avconv command in your PATH, you need to install libav-tools

sudo apt-get install libav-tools

After installing avconv,

avconv -i /input-file-name-with-path output-filename.mp3

This will convert your video input file into mp3.
-i option is used to indicate the input file.

You can use --help for more help and details options.

Mongodb : Install on Ubuntu

December 12th, 2013 § 0 comments § permalink

As part of getting started to NoSQL DB’s I thought of trying out MongoDB.

Installation

Installation was quite easy. Here is how I installed mongoDB on your ubuntu.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

Thats it, installation is over.

Start mongoDB

The mongoDB is setup with upstart, so you can start the service with the following command

sudo service mongodb start

Explore CLI

You can enter into mongoDB CLI to explore more, just type mongo in your terminal

mongoDB CLI

mongoDB CLI

Everything is fine. But when I do unclean shutdown sometimes, mongoDB service won’t start automatically. So after each unclean shutdown I need to do remove the lock file and start service manually.

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb start

Happy exploring mongoDB.

Ubuntu : Add applications to system tray

October 21st, 2013 § 1 comment § permalink

In Ubuntu, by default system-tray won’t show newly installed apps like Xchat or Zeal. This post will walk you though “How to configure system tray to whitelist any application“.

Dconf Editor

We use dconf-editor to update the system-tray whitelist.

Install

You can easily install it with apt-get.

sudo apt-get install dconf-tools

Run it.

You can either type dconf-editor on terminal or click on dash home and search for dconf-editor.

Search

Dash home search

After opening dconf editor, Navigate to Desktop > Unity > Panel there you can find systray-whitelist.

Systray-whitelist before editing

Systray-whitelist before editing

Double click on the value and update to [‘all’] or add your application name to the list.

Eg. Initially the value will be

['JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier', 'Jupiter']

After adding Xchat and Zeal, it become

['JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier', 'Jupiter', 'Xchat', 'Zeal']

or if you are adding all,

['all']
Systray after adding all

Systray after adding all

You are done. Now just logout and login for changes to take effect. After that When you minimise Xchat or Zeal you can find their icon over system try.

 

Boot virtual box as headless

October 10th, 2013 § 0 comments § permalink

If you are running a ubuntu server on a VM, then I highly recommend you to boot VM as headless. Here I use Oracle VirtualBox as my VM.

Why?

The two advantanges I found are

  • Saves some amount of RAM.
  • Anyway I ssh to VM, then one less window opened.

Even before I came to know that I can run VM as headless, I usually boot the VM and keep the window minimized. Then I ssh to VM from my terminal, so I can easily copy and paste text to and fro VM.

How to boot as headless?

You can boot the VM as headless using the command

 vboxmanage startvm precise64 --type headless

and you can shutdown the VM by

vboxmanage controlvm precise64 poweroff

Get ubuntu codename

April 7th, 2013 § 0 comments § permalink

Here is simple command which can give you the codeaname of your ubuntu distribution

lsb_release -c


here is result after running on my machine.

Ubuntu codename

Ubuntu codename

 

Some useful screen commands

January 25th, 2013 § 0 comments § permalink

For multi-tasking on unix server either we need login into server from multiple terminals. But screen program make this easy and we can open multiple windows from the same login.
Main hi-light of this screen program is even though we lost the connection to server, the screen windows survive and we can resume after the nextlogin.  So screen will be useful to run some tedious tasks, so that it will execute in the separate screen and continue the execution even after the ssh connection is timeout.
We can name each screen that we create so that we can easily resume it on next login.
Here are the some useful command for the smooth usage of screen program on server.
screen -S <name> start new screen
 Ctrl + a + c  create new window
 Ctrl + d  close the current window
 Ctrl + a + d  Detach a window
 Ctrl + a + ”  list windows and select
 Ctrl + a + n  next window
 Ctrl + a + p /
Ctrl + a + backspace
 previous window
 Ctrl + a + S  split horizontally
 Ctrl + a  |  split vertically
 Ctrl + a TAB  switch the screen
 Ctrl + a Q  to full screen (remove split)
 screen -x   list all screens
 screen -r <pid.screenname>   resume screen
This is just a beginning. There are lot more to it.
Try man screen to learn more about it
Thanks

Ubuntu : Solving “remote host identification has changed!” issue

July 25th, 2012 § 0 comments § permalink

Have you ever faced this issue while a git clone or a ssh?

Remote host identification

Are you struggling to solve the issue? Then you have to read the error message carefully once more. That error message itself gives you the solution to solve it.

You need to remove the old signature from known_hosts file. Be careful that all the verified signatures are stored in the same file, so you need to remove only the one which is related to the changed host. So you can use the command below for achieving this.

Replace the <user> with your logged in username and <example.com> with domain or ip address of the host you need to connect. Make sure that you are trying to connect with the authentic server.

Install phpunit on ubuntu

February 21st, 2012 § 0 comments § permalink

A few months before I wrote an article on how to install phpunit on windows. Now when I tried to install phpunit on ubuntu I faced an error phpunit/PHPUnit requires PEAR Installer (version >= 1.9.4), installed version is 1.9.2 .

Here is the steps which I used to get rid of this error.

  1. Install php-pear
     sudo apt-get install php-pear
  2. Update its own channel
     sudo pear channel-update pear.php.net
  3. Upgrade pear
    sudo pear upgrade-all
  4.  Now install PHPunit
    sudo pear install –alldeps pear.phpunit.de/PHPUnit 
Now we can check whether installation is success by typing phpunit in terminal.

Yes. It worked.

Happy Testing.