Skip to content

Instantly share code, notes, and snippets.

@vhaidamaka
vhaidamaka / gpg-import-and-export-instructions.md
Created April 3, 2018 09:49 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@vhaidamaka
vhaidamaka / parse-options.sh
Created February 12, 2018 12:52 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@vhaidamaka
vhaidamaka / cleanup_ftp.sh
Created February 11, 2018 12:41 — forked from allanscullion/cleanup_ftp.sh
Bash script to remove old files from an FTP server
#!/bin/bash
PROGNAME=$(basename $0)
OUTFILE="/tmp/ftplist.$RANDOM.txt"
CMDFILE="/tmp/ftpcmd.$RANDOM.txt"
ndays=14
print_usage() {
echo ""

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0