Triggering Commands on File/Directory Changes in Ubuntu

He we will introduce a new linux tool called Incron. It is similar to cron, but instead of running commands based on time, it can trigger commands when file or directory events occur. First of all, install incron using the command

sudo apt-get install incron

Before starting to use incrontab, we must give permissions for a user to . . . → Read More: Triggering Commands on File/Directory Changes in Ubuntu

Custom .screenrc Configuration File

Screen may be the most useful Linux applications when it comes to getting things done through the terminal. This custom screenrc configuration file will provide you with a permanent caption line at the bottom of each window. This caption line will enable you to easily keep track of each terminal window and provide other helpful information . . . → Read More: Custom .screenrc Configuration File

Check Bandwidth Usage In Ubuntu

Install bwm-ng and/or iftop as given below:

sudo apt-get install bwm-ng
sudo apt-get . . . → Read More: Check Bandwidth Usage In Ubuntu

A Simple Script To Get A Terminal Dictionary

First, make sure that you have the Lynx web browser:

sudo apt-get install lynx

Now, make the following script:

#!/bin/sh

lynx -dump “http://wordnet.princeton.edu/perl/webwn?s=$1″ | grep -B 1000 References | grep -A 1000 relations | less

Now you can define any word from the terminal. For example, suppose I want to know the definition of ‘psychoanalysis’, I can simply run:

./define psychoanalysis

and get . . . → Read More: A Simple Script To Get A Terminal Dictionary

Free Up Cache Memory in Ubuntu

Ever wondered how to remove the cache memory in Ubuntu? Linux kernels 2.6.16 and newer provide a mechanism to clear the inode, page, and dentry caches on demand. All you have to do is echo a value to the proc filesystem, and you’re done. Follow the recipe below:

As this is a non-destructive operation and dirty objects . . . → Read More: Free Up Cache Memory in Ubuntu

How To Check Which Software Package Is Using More Space

If you’re running out of disk space and you want to quickly see what packages are using the most space on your hard drive, use the following command

dpkg-query –show –showformat=’${Package;-50}\t${Installed-Size}\n’ | sort -k 2 -n | grep -v deinstall | awk ‘{printf “%.3f MB \t %s\n”, $2/(1024), $1}’

That will sort the packages by size, putting the . . . → Read More: How To Check Which Software Package Is Using More Space

Using Terminal To Check The Size Of A Directory

You can also use a Terminal command to check the size of an individual directory. For instance, if you wanted to check the size of your Documents directory, you would use this command:

du -hs Documents

This will give you the combined size of your Documents folder, along with . . . → Read More: Using Terminal To Check The Size Of A Directory

Adding Public Key For Ubuntu Repositories

Following recipe will help to add a public key to ‘apt’ for repositories not already included in /etc/apt/sources.list. If you get an error ‘NO_PUBKEY XXXXXXXXXXXX’ , just use XXXXXXXXXXXX public key name in the following code.

gpg –keyserver hkp://subkeys.pgp.net –recv-keys XXXXXXXXXXXXXXXXX
sudo gpg –export –armor “XXXXXXXXXXXXXXXXXXX” | sudo apt-key add -
sudo . . . → Read More: Adding Public Key For Ubuntu Repositories

Enabling Spell Checking In Kile Using Aspell

Kile is a top-notch KDE frontend LaTeX editor. Enabling spell checking for it requires a small trick if you’re running Ubuntu, which is Gnome based. Several options, including spell checking, for KDE applications are configured within the KDE control center. To get the job done, proceed as follows:

1. First, you need to install the KDE control . . . → Read More: Enabling Spell Checking In Kile Using Aspell

EXT3 File System On A USB Stick

This how-to will create USB memory stick with ext3 file system. First of all, use sudo fdisk -l to get the device handle of USB stick. It might look something like this:

Disk /dev/sdd: 4041 MB, 4041211392 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
Disk identifier: 0xddeb26e6
Device Boot . . . → Read More: EXT3 File System On A USB Stick