Five Ubuntu Hacks to make your life easier!

When I made the decision to switch from Windows to Linux after the great

Metro

debacle of Windows 8, I knew that the I had to learn and document a few tricks to make my ubuntu deskop as much as (or even better than) Windows. Given in this article are five such ubuntu hacks that came quite handy to me in various situations. I hope you too make the most of it.

Ubuntu Shutdown Dialog

1. Disable animation

One of the first things I do upon installing ubuntu is disable that “eye-candy” animation that most OSX/Windows users are used to. I generally prefer performance to appearance and it goes without saying that disabling the unity animation saves some precious memory and cpu cycles that might be better utilized elsewhere. In order to disable animation, just do this:

  1. Install unity-tweak-tool if you already haven’t.
  2. Trun off Window Manager->General->Window Animations.

2. Enable hibernation

Hibernation is almost an essential feature in laptops nowadays, and though it is disabled by default, you can easily enable it by doing this:

  1. Edit
    /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

    in superuser mode.

  2. Enable
    ResultActive=yes

    for hibernation (both for upower and logind).

3. Add a shutdown shortcut

The first thing I had noticed since migrating from

Windows 7

to

Ubuntu 12.04 LTS

was that I can no longer do a

Ctrl+Alt+Del

on the desktop to bring the

shutdown dialog

anymore! But no worries, you can enable the same in Ubuntu by doing the following:

Open

Settings->Keyboard

and map a key to

gnome-session-quit --power-off

(To assign Ctrl+Alt+Del, you will have to assign another shortcut for logoff first)

4. Learn how to reset your USB Modem:

A nagging issue on many Linux (and even Windows) machines is that the USB modem you use for getting a

Mobile Broadband

connection to Internet just stops responding. What is basically needed here is to reset your USB device. The “practical” way that most folks do this is to physically remove the USB device and plug it back again. But there are ways to reset a USB device in Linux without touching the actual hardware! There are two ways of doing it, first using the standard

usb_modeswitch

command, and second, a more geeky but reliable way of compiling a

C

program to do your job:

METHOD 1: First, perform a

lsusb

, so it gives you the vendor-id and product-id of your USB modem, for example:


Bus 003 Device 002: ID 04f9:0224 Brother Industries, Ltd

In this example the vendor ID is

04f9

, product ID is

0224

(right, its my printer).
To reset the device, we may then issue:

sudo usb_modeswitch -R -v <vendor ID> -p <product ID>

METHOD 2: First, write and compile the usbreset.c program as described here. To run the program, you have to supply the complete path to the usb device including the bus-id like this:


sudo usbreset /dev/bus/usb/001/002

To avoid looking up the

lsusb

each time, just add an alias to your

~/.bashrc

file (make sure to change the vendor search string from

Huawei

to your own):


#Added by Prahlad
alias 'usbresetReliance=sudo /home/prahlad/source/cpp/linux/usbreset /dev/bus/usb/$(lsusb|grep Huawei| sed "s/Bus //"| sed "s/ Device /\//"|sed "s/:.*//")'

5. Add a path to

$PATH

environmental variable in bash prompt

One of the commonest thing you need on the bash prompt is the ability to add to the default

$PATH

environment variable. For instance, if you have copied

java

or

node

somewhere in your

home

directory, you might want to add those paths to

$PATH

so you can run those programs form the bash prompt. Here is how to do it:

  1. Edit
    .profile

    in $HOME folder (and make sure that

    .bash_profile

    and

    .bash_login

    don’t exist as they override your value).

  2. At the last line, set the
    $PATH

    variable as follows:

#Modified by Prahlad:
 PATH=”/home/prahlad/programs/node.js/bin:$PATH”
 PATH=”/home/prahlad/programs/jdk1.8.0_05/bin:$PATH”

Hope this helps. That’s all for now.