How to recover from a power down during Ubuntu update if you can boot with no interface

If that happens for any reason and if you can still boot, but get a broken interface (no mouse and keyboard for me) a possible solution is:

  • BACKUP YOUR STUFF IN YOUR WINDOWS PARTITION IF YOU HAVE ONE: with this program called diskinternals
  • Open a tty (Control + Alt + F2)
  • Login with your username and password (IF YOU HAVE NUMBERS IN YOUR USERNAME, TYPE THEM ABOVE THE LETTERS, NOT IN THE NUM PAD)
  • type sudo apt-get -f dist-upgrade and follow the instructions
Advertisements

Linux one liner enqueue music under current dir into Totem player

find . -type f ( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a"  -o -iname "*.ogg" -o -iname "*.wav" -o -iname "*.wma" ) -print0 | xargs -0 totem

  • ‘-o’ means or: we are choosing either type of file
  • ‘-print0’ + ‘xargs -0’: almighty combo that allows for filenames with newlines

Swap esc and caps lock on Ubuntu 11.10

Why?

  • caps lock is not very useful
  • caps lock changes the keyboard state, which might be undesirable if you want to use in a keyboard macro program such as Autokey which cannot stop Caps lock from changing state
  • the venerable VIM extensively uses Esc to change modes, so you would rather have it closeby

How?

Append some code to your ~/.Xmodmap file. It’s executed at the right time at startup by the xmodmap command, so that your modifications take place every time.

echo "
! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock" >> ~/.Xmodmap