Created
May 2, 2011 20:14
-
-
Save gnubyexample/952265 to your computer and use it in GitHub Desktop.
alias - infolist & baksysconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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