back
#cerca nei repositories un binario e mostra a quale
#pacchetto appartiene (un surrogato di apt-file)
#eventualmente modificare "testing" con altro ramo nel link
### binpack ###
binpack() {
  if [ "$1" = "" ]; then
   echo -e "\033[32mshow package that contains the program"
   echo -e "\033[32musage: binpack <program>"
  else
   w3m -dump "http://packages.debian.org/search?searchon=contents& \
     keywords="$@"&mode=path&suite=testing&arch=any"|grep --color=never -B 4 /
  fi
}
#mostra lista dei file di un pacchetto non installato
#eventualmente modificare "amd64" con "i386" nel link
### deblist ###
deblist() {
  if [ "$1" = "" ]; then
   echo -e "\033[32mshows the structure of files in a package not installed"
   echo -e "\033[32musage: deblist <package>"
  else
   w3m -dump http://packages.debian.org/squeeze/amd64/"$@"/filelist | \
     grep --color=never -B 2 /
  fi
}
#mostra ip esterno
### myip ###
myip() {
   w3m -dump http://checkip.dyndns.org|awk '{print $4}'
}
### indirizzi alternativi
#w3m -dump http://ipid.shat.net/iponly
#w3m -dump http://ip.dnsexit.com
#mostra ip interno
### myintip ###
myintip() {
   /sbin/ifconfig|head -n2|grep inet|awk -Faddr: '{print $2}'|awk '{print $1}'
}
#mostra varie informazioni di sistema
#utilizza alcuni alias e funzioni precedenti
### sysinfo ###
ii() {  
   echo -e "\n\033[32mtoday is:\e[0m " ; date
   echo -e "\nyou are logged onto \033[32m$HOSTNAME"
   echo -e "\nkernel:\e[0m " ; uname -a
   echo -e "\n\033[32mCPU:\e[0m " ; grep "model name" /proc/cpuinfo | \
     awk -F:\  '{print $2}'
   echo -e "\n\033[32mUsers logged on:\e[0m " ; w -h
   echo -e "\n\033[32mMachine status:\e[0m " ; uptime
   echo -e "\n\033[32mMemory status:\e[0m " ; free
   echo -e "\n\033[32mIP Addresses:\e[0m " ; myintip ; myextip
 }
#unzip di molteplici file presenti in una directory
### unzip all ###
unzall() {
   for maggio in $(ls *.zip); do unzip -q $maggio; done
}
#backup della home
### homebkp ###
homebkp() {
 local DATE=$(date +%d-%m-%y)
 local NAME="homebkp-$DATE.tar.bz2"
   tar cvPpjf $NAME --exclude=/home/skizzhg/$NAME \
     --exclude=/home/skizzhg/.VirtualBox /home/skizzhg/
}
back