User Tools

Site Tools


shellsnippets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
shellsnippets [2010/07/14 09:50] 91.32.175.1shellsnippets [2012/12/16 11:28] (current) – [Set system date by time from webserver] 2001:6f8:1c1a:0:922b:34ff:fe18:7138
Line 17: Line 17:
 ===== Delete empty directories ===== ===== Delete empty directories =====
  
-  $> find . -depth -type d -empty -delete+  $> find . -type d -empty -delete
  
 ===== Execute a local shellscript on a remote host ===== ===== Execute a local shellscript on a remote host =====
Line 108: Line 108:
 echo "The scripts absolute path is $p" echo "The scripts absolute path is $p"
 </code> </code>
 +
 +Or you could just use readlink, which also resolves symlinks:
 +
 +    $> readlink -f ~/.bashrc
 +    /home/andi/.bashrc
  
 ===== Print ANSI colors ===== ===== Print ANSI colors =====
Line 154: Line 159:
 Sometimes you want to set the system date of Unix system to some sane value. You could do it manually or use some NTP client. The first idea is too much work ;-) and for the second one you need a time server and some client installed. But why not use the HTTP Response Header ''Date''? Well you could use again some client tool like [[http://www.clevervest.com/htp/intro.html|htp]] or just use this snippet. Sometimes you want to set the system date of Unix system to some sane value. You could do it manually or use some NTP client. The first idea is too much work ;-) and for the second one you need a time server and some client installed. But why not use the HTTP Response Header ''Date''? Well you could use again some client tool like [[http://www.clevervest.com/htp/intro.html|htp]] or just use this snippet.
  
-  #> date -s "`lynx -dump -head http://www.kernel.org |grep 'Date:'|awk -F': ' '{print $2}'`"+  #> date -s "`curl -http://www.kernel.org |grep 'Date:'|awk -F': ' '{print $2}'`"
  
 ===== Backups with afio ===== ===== Backups with afio =====
shellsnippets.1279101024.txt.gz · Last modified: 2010/07/14 09:50 by 91.32.175.1