Thursday 11 August 2011

Recursive find

Sometimes you don't have locate , or you want just to find recursively below your current directory. Here is a handy alias:

alias fn='find . -name':
Example usage: $ fn "page*.htm"

Tip from Joe Grossberg.

Sunday 10 April 2011

Encode video FLV to AVI with one line

Just found on the Ubuntu forums a way to convert FLVs to AVI with a single shell line, using mencoder:

for file in *.flv; do mencoder -oac mp3lame -ovc lavc "$file" -o "`echo $file | sed -e 's/\.flv$/\.avi/'`"; done

Source is this thread.
However with gnome-mplayer it seems I can't always navigate the resulting AVI.

Friday 18 February 2011

OCR of scanned PDFs in Linux

It seems there is still no quick-and-ready solution, but found a few interesting scripts.

This script based on Tesseract worked well for me. It requires to have Tesseract and ghostscript installed, and returns a number of ASCII text files from the PDF. Given that the OCR engine is the same used by Google, you can be assured it works pretty well.

A bit less comfy solution can be found on this Linux.com article, with some shell script based on Tesseract as well.

Another solution using other engines.

It seems also there is a potentially elegant GUI solution by means of OCRFeeder, but I still haven't tried it. I'll let you know how it works, for now I just bookmark these links.

Tuesday 8 February 2011

Install True Type fonts on Ubuntu in three steps

It's very easy:

1)Create a .fonts subdirectory in your home directory
cd ~
mkdir .fonts

2)Move the .ttf file in the .fonts directory
mv myfont.ttf ~/.fonts

3)Refresh the font cache
sudo fc-cache -f -v

And your font should be ready to be used.
Credits to Detector Pro -I streamlined the process a bit, being comfortable with the command line.

Wednesday 26 January 2011

How to symlink all files in a directory

It seems that a simple ln -s /dir/* doesn't work, so:

for f in $(ls -d /base/*); do ln -s $f /target; done && ls -al /target



From commandlinefu.com