*nix Tips & Tricks frequently forgotten..

strict warning: Only variables should be passed by reference in /home/sojacandles/www/jazy.net/drupal/drupal-6.14/sites/all/modules/captcha/captcha.inc on line 61.

Very helpful info here: 20 Linux System Monitoring Tools Every SysAdmin Should Know

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

  • fix the time sudo ntpdate pool.ntp.org
  • tar -pczf name_of_your_archive.tar.gz /path/to/directory
  • tar -zxvf name_of_archive.tar.gz
  • tar -xvjf name_of_archive.tar.bz2
  • tar -tvf filename.tar or tar -ztvf filename.tar.gz (to list contents)
  • To encrypt & tar:
      tar -cj directory | openssl des3 -salt > encrypted.tarfile
    decrypt & untar:
      cat encrypted.tarfile | openssl des3 -d -salt | tar -xvj
  • 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) 
  • ntpdate pool.ntp.org- set time to timeserver
  • at -l (lists currently scheduled jobs)
  • in vi, to remove the pesky ^M end of line chars, type: :%s/^V^M//g (that's ctrl-V, ctrl-M)
    • :%d to delete all text in current vi editor session
  • $find ./ -name 'name.of.file'
  • $grep -H -r "text to find" path/
  • 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/
  • bash tips:
    • a decent bash prompt (save in ~/.bash_profile):
      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"'
    • to unzip all archives in a folder (in bash): for i in *.tar.gz; do echo working on $i; tar xvzf $i ; done
    • command line shortcuts:
      !! - Last command
      !foo - Run most recent command starting with 'foo...' (ex. !ps, !mysqladmin)
      !foo:p - Print command that !foo would run, and add it as the latest to command history
      !$ - Last 'word' of last command ('/path/to/file' in the command 'ls -lAFh /path/to/file', '-uroot' in 'mysql -uroot')
      !$:p - Print word that !$ would substitute
      !* - All but first word of last command ('-lAFh /path/to/file' in the command
      'ls -lAFh /path/to/file', '-uroot' in 'mysql -uroot')
      !*:p - Print words that !* would substitute
  • TOR tips:
    • Go to about:config and make the following changes:
    • network.http.keep-alive.timeout:600
    • network.http.max-persistent-connections-per-proxy:16
    • network.http.pipelining:true
    • network.http.pipelining.maxrequests:8
    • network.http.proxy.keep-alive:true
    • network.http.proxy.pipelining:true
    • network.prefetch-next:false

 If you find yourself SSH'ing into an iOS device, don't forget:  passwd mobile

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

Terminal Services Keys

Raspberry Pi 2 - Kits and Parts