*nix Tips & Tricks frequently forgotten..

in

*nix tips and code snippets i seem to always for get syntax for:

  • tar -pczf name_of_your_archive.tar.gz /path/to/directory
  • tar -zxvf name_of_archive.tar.gz
  • tar -tvf filename.tar or  tar -ztvf filename.tar.gz  (to list contents)
  • rm -f /path/and/folder/to/remove
  • rm -r /path/and/folder/to/removeeven/if/full
  • cp -arv folder/* ../path_to_overwrite_to_move_subfolders
  • at job example: at -f /data/home/www/html/atjob 12:58 10/06/2009 (runs the atjob file, at the specified location, at the specified time)  at -l (lists currently scheduled jobs)
  • download an entire site using wget: 
    • wget --mirror –w 2 –p --HTML-extension –-convert-links –P /path/to/folder/example1 http://www.yourdomain.com
    • a nicer version of the above command, may be:  wget --wait=20 --limit-rate=20K -r -p -U Mozilla http://www.internets.com/
  • to unzip all archives in a folder (in bash): "for i in *.tar.gz; do echo working on $i; tar xvzf $i ; done"
  • Best bash prompt:
    export PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'

 
http://cdburnerxp.se/ - free cd / dvd iso burning software 
Terminal Services Keys