Category Archives: Ubuntu

Add syntax color to crontab editor

You might be wondering why you don’t have syntax coloring when you are editing crontab entries.
This can be solved very simply by specifying your editor before starting crontab:

export EDITOR=vim

The change can be made persistent across the whole system if you add that line on the /etc/bashrc file.
You you only need this change for certain users only, add the line to their local ~/.bashrc files.

Set default gnome terminal size in Lucid Lynx

Use these commands to change the default gnome terminal size:

gconftool-2 --set /apps/gnome-terminal/profiles/Default/default_size_columns \
--type integer 160
gconftool-2 --set /apps/gnome-terminal/profiles/Default/default_size_rows \
--type integer 50

XMLStarlet: command line XML toolkit

XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands.

This set of command line utilities can be used by those who deal with many XML documents on UNIX shell command prompt as well as for automated XML processing with shell scripts.
Ubuntu allready has it in the repos, so issue the following command in your terminal to install it:

sudo aptitude install xmlstarlet

Vacuum your Firefox 3

This tip will hopefully speed up your Firefox 3 by optimizing it’s database.
Firefox stores your browsing data using SQLite – self contained, small footprint database.
Having database store your browsing data has one drawback, you have to optimize the database from time to time to get rid of old, deleted data, re-index the columns etc.
Otherwise you keep all the junk data mixed in with your real data.
In SQLite is the statement to do this called VACUUM. So here’s how to vacuum your Firefox:

1. Download sqlite command line client for your platform. In Ubuntu, go to yout terminal and issue the following command:

sudo aptitude install sqlite3

2. Turn off your Firefox
3. Go to your profile folder
4. Issue the command:
* For Linux

for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done

* For Windows

for %i in (*.sqlite) do @echo VACUUM; | sqlite3 %i

Enjoy!

Turn off or limit the Recent Documents feature in Ubuntu

If you want to turn off the Recent Documents feature in Ubuntu, all you have to do is create a .gtkrc file in your home directory.

touch $HOME/.gtkrc-2.0

Then add gtk-recent-files-max-age=0 to this file.

echo 'gtk-recent-files-max-age=0' | tee -a $HOME/.gtkrc-2.0

This is documented here.
This will also work in any other linux distribution running Gnome.
Enjoy!

Ubuntu One coming to Windows

At PyCon 2010, Ubuntu One development team will focus on helping Ubuntu users who also use a Windows box. This is great news!
Source.

Disable splash screen in Ubuntu 9.10 Karmic Koala

You can disable the splash screen and instead view details about your boot process by following the next steps:
1. Edit grub

sudo vi /etc/default/grub

2. Locate the following line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and remove quiet and splash.
After that, the line should look like this:

GRUB_CMDLINE_LINUX_DEFAULT=""

3. Save and exit.

:wq

4. Now update the grub:

sudo update-grub

That’s it!

Karmic Koala Beta on ThinkPad T61 (continued)

After the latest updates, enabling touchpad on/off key (fn-f8) is now working. There are some annoying gdm random restarts without a trace in the logs. I suspect it’s the nvidia proprietary driver and I hope it will be fixed soon.
Here is a better approach to enable the Active Protection System in your ThinkPad:

# Install HDAPS - IBM Active Protection System Linux Driver
sudo cp /etc/modules /etc/modules_backup
sudo aptitude install tp-smapi-source
sudo module-assistant prepare tp-smapi
sudo module-assistant auto-install tp-smapi
sudo modprobe tp-smapi
sudo aptitude install hdapsd
echo 'tp-smapi' | sudo tee -a /etc/modules

Search and remove duplicate files

Here a small piece of code which will search for the duplicates in the path you supply. It will generate a new file which contains the commands for deleting those duplicates.
Make sure you double check the resulting file!
The script requires that you have fdupes installed.
Install it in Ubuntu/Debian by running the following command in your terminal:

sudo aptitude install fdupes
#!/bin/bash
 
OUTF='rm-dups.sh'
echo "#!/bin/bash" > $OUTF
fdupes -r -f $1 | sed -r 's#(.+)#rm '\"'\1'\"'#' >> $OUTF
chmod +x $OUTF

Karmic Koala Beta on ThinkPad T61

I just installed Ubuntu 9.10 Beta on my LENOVO ThinkPad T61 64608NG.
Here is what I found so far, in two days of intensive usage:

Quadro NVS 140M – 2D and 3D acceleration: tested and works.
Wireless switch: tested and works.
Sound: tested and works.
Enabling touchpad on/off key (fn-f8): not working.
Enabling Active Protection System: works by installing tp_smapi.
Read the complete guide here.
Fingerprint Reader: install thinkfinger-tools and libpam-thinkfinger from the repository and everything works.
Network Card Intel 10/100/1000: tested and works.
Wireless Intel PRO/4965AG: tested and works.
Card reader: not tested.

UPDATE: Power level of the fingerprint reader is set to on by default, so it gets hot pretty fast. Use one of the scripts here to set it to auto at boot time.
Note that the path /sys/class/usb_*/*/device is no longer working. Instead, use /sys/class/usbmon/usbmon*/device/usb*/*.
Here is the complete script for that, taken from thinkwiki.org and modified to reflect the new path.

#!/bin/bash
 
# find the fingerprint reader and change its power level to autosuspend
find_manuf=STMicroelectronics
find_prod="Biometric Coprocessor"
 
for devdir in /sys/class/usbmon/usbmon*/device/usb*/*; do
  [[ -r $devdir/manufacturer ]] || continue
  manuf=$(<$devdir/manufacturer)
  [[ $manuf = $find_manuf ]] || continue;
  prod=$(<$devdir/product)
  [[ $prod = $find_prod ]] || continue;
  # if we get here then we have the right device!
  plevel_file=$devdir/power/level
  old_level=$(<$plevel_file);
  # if it is already set properly then exit silently:
  [[ $old_level = auto ]] && exit 0
  # if we successfully change it then exit silently:
  echo auto >$plevel_file && exit 0
  echo "Failed to set the fingerprint reader's power level to 'auto'."
  exit 1
done
 
# if we make it through the for loop without exiting, the search failed
echo "Could not find the $find_manuf $find_prod (fingerprint reader)"
exit 1

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close