Archive

Archive for August, 2009

Bulk Rename – Replace Space with Underscore

August 26th, 2009 subogero Comments off

A small script to perform bulk renaming of files, replacing spaces with underscores and exotic letters with sanitized versions.

Save this link as /usr/bin/s2u.

#!/bin/sh
ls -1 | while read -r FILE; do
  mv -v "$FILE" `echo $FILE | tr ' áéíóöïúü' '_aeiooouu'`;
done
Categories: posts Tags: , , ,

Firefox Hotkeys

August 16th, 2009 subogero Comments off

I always found Tab-based programs like Firefox awkward to use, as I could not change between or close tabs with the known Alt-Tab, Alt-F4 hotkeys. Until now.

Check out this extremely useful post.

New tab             Ctrl-T
Close tab           Ctrl-W
Undo close tab      Ctrl-Shift-T
Next tab            Ctrl-Tab
Last tab            Ctrl-Shift-Tab
Bookmark tab        Ctrl-D
Select address bar  Alt-D
Select search bar   Ctrl-K

Never have to ckick again in Firefox !!! Erm, on second thoughts…

Categories: posts Tags: , ,

Ubuntu vs XP Reboot Time

August 15th, 2009 subogero Comments off

I’ve just measured full reboot times with Ubuntu and Windows XP on the same machine.
Bonus: reboot times with Ubuntu Jaunty on Asus UL20A laptop (its BIOS is extremely fast too).

                             Ubuntu       XP  |  Ubuntu ASUS UL20A
----------------------------------------------|-------------------
boot from BIOS until login     26 s     29 s  |                17s
boot from login until ready    16 s     39 s  |                15s
reboot until BIOS              19 s     35 s  |                12s
----------------------------------------------|-------------------
overall reboot without BIOS    63 s    103 s  |                44s

No comment.

Categories: posts Tags: , ,

Manual Pages

August 15th, 2009 subogero Comments off

The day has come, and I’ve started writing documentation, but this time Linux style. In other words, I’ve just created the manual pages for my Newbie-projects, “ogc” and “go“.

Some important points I’ve learned from the Linux Man Page Howto:

Manual pages are written in the “groff” (GNU troff) markup language. Just start from another program’s man page, it’ll be easy.

Manual pages of user-commands shall be installed into “/usr/share/man/man1″

The manual page of user-program “foo” shall be called either “foo.1″ or “foo.1.gz” (gzipped).

To read foo’s manual page, type

man foo

It’s that easy.

Categories: posts Tags: , ,

Automount an NTFS Partition

August 14th, 2009 subogero 4 comments

As I have a Windows-Ubuntu side-by-side installation with a boot menu, I still store a lot of data on the NTFS partition. I know, I know…

Ubuntu endeavours to give satisfaction, so you can see all detected storage devices in the “Main Menu” under “Places”. Click your NTFS partition, and it’s mounted automatically to /media/disk/.

But if you want to access these files from another program before clicking it in “Places”, it does not work. So I googled “automount ntfs partition” and there it was.

I added the following line to “/etc/fstab”:

# <file system> <mount point>   <type>  <options>                <dump>  <pass>
/dev/sda1       /media/disk     ntfs    users,defaults,umask=000 0       0

I rebooted. I did not work. It took me a few days until I realised one cannot mount something in a non-existent directory. When you click your NTFS partition in “Places”, Ubuntu not only mounts it, but creates the mount-point directory “/media/disk” first. But just adding something to “/etc/fstab” does not create directories. People would talk. Eyebrows would be raised.

After a

sudo mkdir /media/disk

and a reboot it worked perfectly.

This must be ridiculously obvious to a Hacker, but the post may help a Newbie or two like myself.

Categories: posts Tags: , ,

Perfection in Design

August 11th, 2009 subogero Comments off

From esr’s book “The Cathedral and the Bazaar“:

Antoine de Saint-Exupéry (who was an aviator and aircraft designer when he wasn’t authoring classic children’s books) said:

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Categories: posts Tags: , ,

Gnome Main Menu Icon Size – Solved

August 10th, 2009 subogero Comments off

The problem with the Main Menu’s huge icons and spacing is solved. I’ve just found the tool called GNOME Color Chooser. Go to the “Icon” Tab.

sudo apt-get install gnome-color-chooser
Categories: posts Tags: ,

There is Tao in Windows start

August 7th, 2009 subogero Comments off

We all remember from the Tao of Programming when the master programmer avoided an embarrassing question about the presence of Tao in DOS. The good news is there is definitely Tao in Windows (but not too much).

It’s called “start“.

It’s not the Start Menu, but a command-line keyword, obviously. I’ve come to appreciate its beauty only after having spent some weeks with Ubuntu. I kept looking for something similar on the internet, and all I found was the “gnome-open” command. Still, the blog-post has ecstatic comments.

I tried “gnome-open”. It opened any file or URL with the associated program as an independent process. So far so good. Until I tried to start a program with “gnome-open”. No way. This was the moment I discovered Tao in Windows’ “start”. Let’s see:

“start” without arguments will open a new terminal window.

“start” with a CLI program as an argument will open it in a new fully independent terminal window.

“start” with a Windows program as an argument will open just that in a fully independent window.

“start” with a file or URL as an argument will open it with the preferred application.

“gnome-open” can do the latter, but not the first three options. So I decided to write my Linux-version of “start” called “go”. Please go to the page.

Back to Windows. The famous “start” has a significant drawback. As in Windows nearly none of the applications are on the PATH, start’s capabilities are just a tiny bit limited. Not so with “go”.

Panel-Launcher for a Root-Terminal

August 7th, 2009 subogero 4 comments

Another not-so-trivial problem with a beautifully simple solution within half an hour. First I created a panel launcher and started hacking its Command Line.

sudo gnome-terminal

Wrong. Nothing happens.

gnome-terminal -e su

Looks better, a terminal-window appears, but disappears again after entering the password. Should have remembered. If a command is specified, bash does not become interactive, closes when the command is completed.

sudo bash

That’s it, baby!

Categories: posts Tags: ,

Everything Can Be Solved in Linux, Except…

August 4th, 2009 subogero Comments off

I still have a few problems I can’t solve. One is The Ubuntu-Firefox Font-Size Disaster. The whole internet is full of it, but no one seems to know the solution.

The problem is that on many web-pages the fonts are incredibly small. The funny thing is that Firefox on Windows displays theses pages perfectly. There are dodgy workarounds like overriding the web-page’s font settings or zoom in (and out, and in), but I can say only two words: Come On!

The other problem is the spacing and icon-size of the Ubuntu Main Menu. This monstrously huge and wasteful spacing even remains when I disable the menu icons altogether. Again, I found a lot of websites about themes and metacities and gtk, but I still have to figure out what these mysterious things mean. At least it all seems to be text-based, so I’ll find the solution one day…

Categories: posts Tags: , , ,