Check Bandwidth Usage In Ubuntu
Install bwm-ng and/or iftop as given below:
sudo apt-get install bwm-ng
sudo apt-get install iftop
Enjoy!
Install bwm-ng and/or iftop as given below:
sudo apt-get install bwm-ng
sudo apt-get install iftop
Enjoy!
Use uniconverter to convert .cdr file to any other format required.
Or use SK1 (http://sk1project.org/)
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 the definition printed out.
It’s nothing fancy; just grabs the output from an online dictionary and spits it out to the terminal, but I find it to be very useful.
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 are not freeable, run:
sync
To free pagecache:
sudo sh -c "echo 1 > /proc/sys/vm/drop_caches"
To free dentries and inodes:
sudo sh -c "echo 2 > /proc/sys/vm/drop_caches"
To free pagecache, dentries and inodes:
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
Hope this works for you all.
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 largest ones on the bottom. If you only want to see the top few, you can type
tail -n 10
at the end, because in all likeliness you have a *lot* of packages installed
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 any subfolders.
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 apt-get update
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 center
sudo apt-get install kcontrol
2. Then, open KDE control center by running the kcontrol command, navigate to KDE Components -> Spell Checker and set the spell checking Client to ASpell
3. Spell checking will now be enabled next time you start Kile!
After I decided to manage my PhD thesis and projects with subversion, the most important thing to consider was a proper backup strategy. I decided to go a bit overboard with it as it might save me some day. There are several ways to backup subversion and I decided to use all of them!
a. Using crontab and rsync to backup subversion
Read my earlier post on crontab if you are not familiar with it. Someday I will write about rsync as well. But for now read this if you are new to rsync. I use the following code to backup the entire subversion repository to my backup directory.
rsync -av --delete --progress /source_directory/subversion/ /destination_directory/backups/subversion_backup/
I used crontab to schedule the above job to run at midnight every day. In case something happens to the original subeversion repository, it is easy to retrieve data from this backup - just copy it to the original location!
b. Using the backup script from COLLABNET (the subversion guys)
The next technique it to use the python based backup script from subversion called hot-backup.py. This script can be used to make a backup of the latest version of the subversion repository. I used the following code to download the latest version from COLLABNET website and install it on my system.
wget http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in
mv hot-backup.py.in hot-backup.py
Once that is done, I had to make some configuration changes in the file. The following lines were changed
# Path to svnlook utility
svnlook = r"@SVN_BINDIR@/svnlook"
# Path to svnadmin utility
svnadmin = r"@SVN_BINDIR@/svnadmin"
to look like this
# Path to svnlook utility
svnlook = r"/usr/bin/svnlook"
# Path to svnadmin utility
svnadmin = r"/usr/bin/svnadmin"
The next step is to run the script check if everything is fine. I used the code below:
python hot-backup.py --archive-type=zip --num-backups=10 ~/source_directory/subversion_repository /destination_directory/subversion_backup/
The above code will make a hotcopy of the latest version of the subversion repository into the backup directory in zip format. A total of 10 backups will be maintained at a time, oldest one being deleted when new ones are added.
Once the backup was properly inspected I created a cron job to run this command at midnight every day.
c. Using the subversion ‘hotcopy’ command
This is a very simple technique as it uses the inbuilt ‘hotcopy’ command to backup the svn repository. Follow the command below to make a reliable incremental backup of your svn repositories.
svnadmin hotcopy /source_directory/subversion_repository /destination_directory/subversion_backup/
Create a cron job to schedule it.
Once you have your backup system in place, rest assured that your data are safe.
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 Start End Blocks Id System
/dev/sdd1 1 61664 3944719 b W95 FAT32
Now unmount it by typing:
sudo umount /dev/sdd1
Afterwards, format the USB stick using the following code. Remember to spell the USB device properly. This command is quite dangerous, it will erase everything on the drive specified.
sudo mkfs.ext3 /dev/sdd
Now that the USB stick is formatted, a new partition has to be create on it. Type:
sudo fdisk /dev/sdd
to create a partition on the USB stick. This will be the new sdd1 partition. After this is done it has to be formatted again using:
sudo mkfs.ext3 /dev/sdd1
to get the ext3 file system on it.
Now then, label the new ext3 USB stick using the command:
sudo e2label /dev/sdd1 usb_backup
Automatically mounting the USB stick when the server reboots
After the usual backup of the /etc/fstab, edit it to include a new line at end:
/dev/sdd1 /media/usb-backup ext3 user,rw 0 0
Create a new directory ‘usb-backup’ and make it readable and writable by the user:
sudo mkdir /media/usb-backup
sudo chmod 755 /media/usb-backup
Use sudo mount -a to mount the drive.
This USB stick can now act as a backup disk.