Extract text from PDF, from the command line

pdfs-512pdftotext is a command line tool for converting PDF files to plain text. Included by default with many Linux distributions.

$ pdftotext file.pdf

The gs (Ghostscript) program can also handle the process:
$ gs -sDEVICE=txtwrite -o extractedText.txt input.pdf


View a “table” via the Linux command line

It’s very common to use the “less” command to view a table, maybe with the “-x 20” parameter to have a smaller chance of misaligned columns, but Google gave me much better way to view CSV (or TSV) files:

column -s, -t < file.csv | less -#2 -N -S

As you can see the “column” command allows to be customized in terms of field separator and much more.

Lightweight browser: small footprint but opening GMail

When in a need for a responsive browser I thought to be limited in my choice among fully featured browsers (Chromium) that nicely support javascript and HTML5, or stripped down crashing things (Arora, Midori?)…

Found a couple of alternatives:

  • QupZilla: it is fully featured… but in my hands still too crashy
  • uzbl (http://www.uzbl.org/): blazing fast, fully featured browsing, zero features browser (type the address with a sort of vi-like console!)

Alternative shell interfaces in Ubuntu Linux

Faster than default Gnome-terminal, they can be installed via repository. They run under X and don’t require Gtk or Qt libraries…

1) xterm, is quite fast. I use it as a nice replacement with this shortcut:

xterm -fs 11 -fa "Courier 10 Pitch"

2) mrxvt is very fast, with nice tabs. I run it in default configuration, without antialiasing or background to keep good performance.

Tab complete for SSH

This snippet from .bashrc/.bash_profile was gifted from Marcel Molina, but I thought I would share because it’s life changing. Put this in your .bashrc or .bash_profile:

SSH_COMPLETE=( $(cat ~/.ssh/known_hosts | \
cut -f 1 -d ‘ ’ | \
sed -e s/,.*//g | \
uniq | \
egrep -v [0123456789]) )
 complete -o default -W ”${SSH_COMPLETE[*]}” ssh

screen configuration file

Screen is a powerful utility to have multiple terminal opened. It’s handy to write a configuration file to add a status bar listing all terminal opened (like the taskbar of visual environments), and that dock to F11 and F12 (instead of F1 and F2) the shortcuts for next/previous screen. Here how to do:  

# Bind F11 and F12 (NOT F1 and F2) to previous and next screen window
bindkey -k F1 prev
bindkey -k F2 next
startup_message off

# Window list at the bottom.
hardstatus alwayslastline
hardstatus string "%-w%{= BW}%50>%n %t%{-}%+w%<"

The hardstatus creates a “task bar” listing all screens, with the active one highlighted. To understand switches, read this guide.