{"id":266,"date":"2007-01-22T17:24:26","date_gmt":"2007-01-22T22:24:26","guid":{"rendered":""},"modified":"2009-12-23T16:10:42","modified_gmt":"2009-12-23T21:10:42","slug":"a-quick-and-dirty-uploaddownload-speed-calculator","status":"publish","type":"post","link":"https:\/\/emresaglam.com\/blog\/blog\/2007\/01\/22\/a-quick-and-dirty-uploaddownload-speed-calculator\/","title":{"rendered":"A quick and dirty upload\/download speed calculator."},"content":{"rendered":"<p>Scenario: You`re at work, you upload something BIG to your home machine. You leave work. You come home, you want to see the progress and you also want to know the speed of the upload\/download. (if the connection stalled or not) (Our test file is: hda1.tar.gz)<\/p>\n<p>You can try: watch ls -al hda1.tar.gz<\/p>\n<p>But I wanted something more numeric \ud83d\ude1b Like bytes\/sec, ETA, etc&#8230; <img src=\"images\/smiley\/laugh.gif\" border=\"0\" alt=\": )\" align=\"top\" \/> So I wrote this little script.<\/p>\n<blockquote><p>#!\/bin\/bash<\/p>\n<p># Usage:<br \/>\n# speed.sh &lt;filename&gt; [&lt;filesize&gt;]<\/p>\n<p>clear<br \/>\nOLDFILESIZE=`ls -al &#8220;$1&#8243;| awk &#8216;{print $5}&#8217;`<br \/>\nsleep 2<br \/>\nwhile true; do<br \/>\nFILESIZE=`ls -al &#8220;$1&#8221; | awk &#8216;{print $5}&#8217;`<br \/>\nlet &#8220;DIFF = $FILESIZE &#8211; $OLDFILESIZE&#8221;<br \/>\nlet &#8220;SPEED = $DIFF \/ 2 \/ 1024&#8221;<br \/>\nif [ $2 ]<br \/>\nthen<br \/>\nlet &#8220;ETA = (($2*1024*1024) &#8211; $FILESIZE )*2 \/ $DIFF&#8221;<br \/>\nlet &#8220;ETAM = $ETA\/60&#8221;<br \/>\necho &#8220;Filesize: $2MB | Downloaded: $FILESIZE bytes&#8221;<br \/>\necho &#8220;$1 download speed = $SPEED Kb\/s\u00a0 | ETA: $ETA s &#8211; $ETAM m&#8221;<br \/>\nelse<br \/>\necho &#8220;Downloaded: $FILESIZE bytes&#8221;<br \/>\necho &#8220;$1 download speed = $SPEED Kb\/s&#8221;<br \/>\nfi<br \/>\nlet &#8220;OLDFILESIZE = $FILESIZE&#8221;<br \/>\nsleep 2<br \/>\nclear<br \/>\ndone<\/p><\/blockquote>\n<p>Pretty self explanatory <img src=\"images\/smiley\/laugh.gif\" border=\"0\" alt=\": )\" align=\"top\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scenario: You`re at work, you upload something BIG to your home machine. You leave work. You come home, you want to see the progress and you also want to know the speed of the upload\/download. (if the connection stalled or not) (Our test file is: hda1.tar.gz) You can try: watch ls -al hda1.tar.gz But I &hellip; <a href=\"https:\/\/emresaglam.com\/blog\/blog\/2007\/01\/22\/a-quick-and-dirty-uploaddownload-speed-calculator\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">A quick and dirty upload\/download speed calculator.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/posts\/266"}],"collection":[{"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":2,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":870,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/posts\/266\/revisions\/870"}],"wp:attachment":[{"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/emresaglam.com\/blog\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}