Posts tagged with “linux”

Bash trick: using grep for faster history search

Here's a neat little trick that makes it easier to find a specific command in the Bash history. Add the following alias to the .bashrc file:

alias hist='history | grep --color=auto'

Say, you want to find a previously used rsync command. In the terminal, run hist rsync, and you should see a list of all matching commands saved in the .bash_history file. To run the desired command, use !000, where 000 is the command's number.

A proper good-bye to Little Backup Box

Little Backup Box has been by far my most successful and popular project. But about two years ago, I chose to transfer it to a new maintainer, effectively abandoning the project. The other day, it occurred to me that I had never said a proper good-bye to my project. So here it goes.

As it often happens, I started working on the project to solve a problem I had: I didn't want to schlep around a laptop when traveling, but I wanted to have a backup solution to keep my photos safe. As Raspberry Pi had been making waves as a versatile platform for all kinds of projects, I thought I'd try to build a Raspberry Pi-based backup appliance that would replace a proper laptop. And over the years, various Raspberry Pi models running Little Backup Box served me well during my travels.

Continue reading

Learning to appreciate ThinkPad X380 Yoga

A while ago, I bought a ThinkPad X380 Yoga. I saw it on eBay, it was cheap, and I've never really tried a convertible laptop before. So I thought, Why the heck not? When the machine arrived, I promptly installed Linux Mint on it.

ThinkPad X380

Everything worked out of the box, including display rotation and touch screen. I tried the pen, and it worked too. And while I thought it was rather neat, I wasn't immediately sold on the whole poke-your-screen-with-a-pointy-plastic-thing idea. But the more I use the machine, the more I appreciate the concept.

Continue reading

Super quick guide to Espanso

Espanso is a text expanding utility, and it's really good at what it does. If you find yourself typing the same text (your name, address, greetings, etc.) over and over again, Espanso is what you need. Deploying the tool is a matter of grabbing the right package, installing it, and running it as a service:

wget https://github.com/federico-terzi/espanso/releases/download/v2.2.1/espanso-debian-x11-amd64.deb
sudo apt install ./espanso-debian-x11-amd64.deb
espanso service register
espanso start

The example above uses Espanso 2.2.1 for Debian with X11. So if you use a different setup, adjust the first two commands accordingly.

To add text expansion rules, switch to $HOME/.config/espanso/match and open the base.yml file for editing.

An expansion rule consists of a trigger (that is, an abbreviation) and a text that replaces it:

- trigger: ":hello"
  replace: "Oh, hello there!"

Add the rules you need, and you're done. When you save the changes, Espanso automatically reloads, and you can use triggers everywhere — including command-line applications.

Get your exact position with a Bash one-liner

Need to get the geographical coordinates of your current position? On a Debian and Linux Mint, install the geoclue-2-demo package using the sudo apt install geoclue-2-demo command, then run the following one-liner:

/usr/libexec/geoclue-2.0/demos/where-am-i | grep -e 'Latitude' -e 'Longitude' | tail -n 2

If you need the latitude and longitude values only, use this one-liner instead:

/usr/libexec/geoclue-2.0/demos/where-am-i | \
grep -e 'Latitude' -e 'Longitude' | tr -d ' ' | \
cut -d':' -f2 | tr -d ° | tail -n 2