Skip to content

Instantly share code, notes, and snippets.

@gnubyexample
Created May 2, 2011 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnubyexample/952265 to your computer and use it in GitHub Desktop.
Save gnubyexample/952265 to your computer and use it in GitHub Desktop.
alias - infolist & baksysconfig
#!/bin/dash
# (c) Gary Wright 2011 now released into public domain.
alias infolist="(cd /var/lib/dpkg/info/;find . -type f -name '*.list' -printf '%f\n' | awk -F'\\\.list' '{print \$1}' | awk -F':' '{print \$1}')"
# --field-separator argument in awk section (-F) includes 3 backslashes (\\\) before the period (.) which is deliberate.
#
# Note: The alias shown here are for easy copy and pasting. Do not expect this shell script to set alias for you. Think.
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 -"
# infolist and baksysconfig alias first dented on identi.ca 20110502
# http://identi.ca/notice/72508459
# http://identi.ca/gnubyexample/favorites
# Prior to an Ubuntu Natty experience, the second (extra) awk was not required
#alias infolist="(cd /var/lib/dpkg/info/;find . -type f -name '*.list' -printf '%f\n' | awk -F'\\\.list' '{print \$1}')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment