System Administrators sometimes share their timesaving tips, here I share two.

alias baksysconfig="cd /bak/this/sysconfig/; \
/bin/echo '*shadow* *secret* etc/ssh/ssh*_key etc/.*secret* etc/*/*secret* ' | \
/usr/bin/tr ' ' '\n' | \
tar --wildcards --checkpoint=100 --exclude '*shadow*' -X - -cf etc__`/bin/date +%Y%m%dT%H%M`U.tar /etc; \
cd -"

… and …

alias infolist="(cd /var/lib/dpkg/info/;find . -type f -name '*.list' -printf '%f\n' | awk -F'.list' '{print \$1}')"

You probably already have a local shell startup script, that sets your aliases, and includes your own handy entries.

The –checkpoint flag for tar is a great manual check that:

  • Something actually gets put in the tar file
  • Your whole filesystem is not getting shoved into the tar file
Copying and pasting Linux command lines from the web, it is easy to miss a bit of the command.
Those two points I listed might sound really obvious, but when working in space limited VPS environments, a typo that results in the whole filesystem being tarred, is not a good situation 😐

Advertisements