How to install an operating system to a USB drive

Sometimes, maybe for maintenance or data rescue reasons, you may want to have a USB thumbdrive with a GNU/Linux distribution installed. I’m not referring to writing a live ISO to a USB drive; I really mean having the distribution installed like it would be on an hard drive. An easy way to achieve this is using the virtualization software Qemu. Example:

sudo qemu-system-x86_64 -boot d -cdrom void-live-x86_64-20171007.iso -hda /dev/sdb -m 800

In this example, the -hda /dev/sdb part tells Qemu that the device /dev/sdb (the USB drive) must be used as an hard drive.

If you prefer Ubuntu, Fedora, Arch or any other distribution, you can install them this way too. There may be a need to adjust QEMU arguments, but in that case Google is your friend.

This also works with other operating systems that are not Linux based. OpenBSD, version 6.3, can be installed in a USB drive using the same parameters and booted after that.

Kalashnikov unveils a retro-styled electric car

kalashnikov cv-1

Russian weapons manufacturer Kalashnikov unveiled a line of electric and hybrid cars, buggies and motorcycles this week. One of those vehicles is a retro-styled concept car named CV-1, capable of running for 350 kilometers with a single charge and accelerating from 0 to 100 km/h in 6 seconds. And it doesn’t look that bad.

Canhoto ou destro, tudo depende da espinha dorsal

A espinha dorsal – e não o cérebro, como se pensava até agora – é que define se somos canhotos ou destros. Esta conclusão foi avançada num artigo da autoria investigadores da Universidade Ruhr de Bochum, juntamente com outros investigadores da Holanda e África do Sul.

Um estudo publicado no eLife no ano passado sugere que, ao contrário do que se pensava, não nasces canhoto(a) ou destro(a) devido às diferenças genéticas entre os dois hemisférios do teu cérebro, mas sim a um mecanismo na espinha dorsal.

Para saberes mais sobre este estudo e como funciona este mecanismo, lê o texto que escrevi no Espalha Factos.

Bash: how-to improve history manipulation

By default, up and down keys allow you to navigate your bash history. Another option is the history built-in command and bash expansions (ex.: !2 runs the second command, oldest to newest, from your bash history).

There are also tools, like bash-it, that allow for better history manipulation, but this also adds a lot of other stuff, so it might make your .bashrc load slower. It will make your bash look good as hell too.

Another option for an awesome way to access your bash history is the following snippet, based on bash-it‘s history plugin:

if [ -t 1 ]
    bind '"\e[A": history-search-backward'
    bind '"\e[B": history-search-forward'

With this, you only need to write part of a command, press the up arrow and it will complete it with the commands in bash history file that match to what you’ve written.

I’ve add it to the end of my .bashrc. Together with bash completion, it improves my workflow by a lot.