Félix Albertos Marco

Utilities

Home/resources/util>

Utilities

[resources] [util]

Bash

Create bootable USB drive

With fdisk -l you’ll get the device corresponding the usb drive. Once you got it (e.g. /dev/sda) you’ll write the iso image (e.g. from ~/downloads/linux.iso) to the drive with dd, as follows:

sudo dd bs=4M if=~/downloads/linux.iso of=/dev/sda stataus=progress oflag=sync

Extra: To wipe out the partition tables (only), use the wipefs command:

wipefs -a

Use an edition interface in line vim style in your bash shell, just include the following opcion in your ~/.bashrc file:

set -o vi

Bonus: If you want to show the current mode, which is really convenient, try including the following code in your /etc/inputrc file:

set show-mode-in-prompt on
set vi-cmd-mode-string "|c|"
set vi-ins-mode-string "|i|"

The result will look something like this:

|i|user@machine:~$ Hello wo

Rename a number of files in nested folders:

find */*.ext -type f -exec rename 's/oldtext/newtext/' '{}' \;

Suspend from the cli

As part of pm-utils, pm-suspend suspends the device, saving system state in RAM.

apt install pm-utils
pm-suspend

Manage music library from the cli

Beets is the best command-line tool for viewing, querying, and renaming your music collection.

$ pip install beets
$ beet config -e
$ beet import path
$ beet list
$ beet update

Keep your password secured with gpg2 in a very simple way

Pass is a very simple password store that keeps passwords inside gpg2 encrypted files inside a simple directory.

Manage multiple ssh identities in github

Here is a little script to manage multiple ssh identities in github. I named it gitssh and it can be used instead of the git command. It works with the same arguments, but before executing the actions it shows a menu (fzf has to be installed) to chose the ssh identity to be used.

#!/bin/bash
sel=$(ls ~/.ssh/*.pub|rev|cut -d / -f 1|rev|cut -d . -f 1|fzf)
exe='ssh-add ~/.ssh/'$sel';git '$@
ssh-agent sh -c "$exe"

PDF

Merge pdf pages

$ pdfunite
pdfunite version 22.02.0
Copyright 2005-2022 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
Usage: pdfunite [options] <PDF-sourcefile-1>..<PDF-sourcefile-n> <PDF-destfile>
  -v             : print copyright and version info
  -h             : print usage information
  -help          : print usage information
  --help         : print usage information
  -?             : print usage information

Verify digital signatures on PDF documents in the cli

To verify digital signatures using the command line interface use pdfsig.

$ pdfsig document.pdf

Vim

Window Management

Take a screenshot

$ import screenshot.png

Part of the imagemagick package.

Configure connected devices

autorandr - automatically select a display configuration based on connected devices.

This software can be used to save/restore monitors connected on I3.

Cast Audio&Video from Linux to Google Cast devices

Cast your Linux or macOS audio and video to your Google Cast devices, e.g. Chromecast.

$ mkchromecast --video --screencast