Skip to content

Instantly share code, notes, and snippets.

@zed9h
Created February 17, 2010 15:41
Show Gist options
  • Save zed9h/306726 to your computer and use it in GitHub Desktop.
Save zed9h/306726 to your computer and use it in GitHub Desktop.
track file upload progress on firefox or any other single-threaded linux browser
#!/bin/bash
export FILE=$1
export BROWSER=firefox
export PID=$(ps aux | sed -n "/grep/d;s/^$USER *\([0-9]\+\) .*\<$BROWSER.*/\1/p")
export FD=$(ls -l /proc/$PID/fd/ | sed -n "s/.* \([0-9]\+\) -> [^ ]*$FILE$/\1/p") # FIXME convert file to pattern
watch "cat /proc/$PID/fdinfo/$FD | sed -n 's/pos:\t//p' ; stat -L /proc/$PID/fd/$FD -c %s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment