| 
 | 13 years ago 1 | 
Saturday, December 31 2011 @ 01:07am
This is a simple single command that I run in a ssh session to my ASUS RT-N16 router with TomatoUSB. I guess this command should be similar in Linux. This can be a very quick status check as I find using the web-interface is much involved. Anyway, I am doing this from my Linux Mint 11.
cmd:
 transmission-remote -n 'usrname:pwd' -t 3 -if | sort -k 1.5 -r | head -n 999999 | grep "\<Yes\>"
Following is a sample session:
 Tomato v1.28.0905 MIPSR2-070V K26 USB AIO
 
 / # transmission-remote -n 'usrname:pwd' -t 3 -if | sort -k 1.5 -r | head -n 999999 | grep "\<Yes\>"
  88: 100% Normal   Yes 94.98 KiB  Bobbys/Self Mastery 001.srt
  89: 100% Normal   Yes 66.09 KiB  Bobbys/Self Mastery 002.srt
  84: 100% Normal   Yes 53.60 KiB  Bobbys/Self Mastery 003.srt
  87: 100% Normal   Yes 110.3 KiB  Bobbys/Self Mastery 004.srt
  83: 100% Normal   Yes 104.3 KiB  Bobbys/Self Mastery 005.srt
  85: 100% Normal   Yes  1.96 KiB  Bobbys/Self Mastery 006.srt
  86: 100% Normal   Yes  0.34 KiB  Bobbys/Self Mastery 007.txt
  90: 100% Normal   Yes  0.05 KiB  Bobbys/Self Mastery 008.txt
  43:  39% Normal   Yes 700.2 MiB  Bobbys/Self Mastery 001.avi
  78:  35% Normal   Yes 695.9 MiB  Bobbys/Self Mastery 002.avi
  37:  31% Normal   Yes 699.3 MiB  Bobbys/Self Mastery 003.avi
  76:  30% Normal   Yes 701.6 MiB  Bobbys/Self Mastery 004.avi
  69:  29% Normal   Yes 704.1 MiB  Bobbys/Self Mastery 005.avi
  31:  29% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 006.avi
  36:  29% Normal   Yes 699.7 MiB  Bobbys/Self Mastery 007.avi
  71:  29% Normal   Yes  1.37 GiB  Bobbys/Self Mastery 008.avi
  77:  28% Normal   Yes 700.3 MiB  Bobbys/Self Mastery 009.avi
  45:  25% Normal   Yes 750.3 MiB  Bobbys/Self Mastery 010.avi
  74:  25% Normal   Yes 700.5 MiB  Bobbys/Self Mastery 011.avi
  40:  25% Normal   Yes 700.3 MiB  Bobbys/Self Mastery 012.avi
  42:  25% Normal   Yes 700.2 MiB  Bobbys/Self Mastery 013.avi
  61:  24% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 014.avi
  50:  24% Normal   Yes 698.3 MiB  Bobbys/Self Mastery 015.avi
  53:  23% Normal   Yes 700.4 MiB  Bobbys/Self Mastery 016.avi
  38:  22% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 017.avi
  75:  22% Normal   Yes 698.9 MiB  Bobbys/Self Mastery 018.avi
  39:  21% Normal   Yes 700.2 MiB  Bobbys/Self Mastery 019.avi
  82:  21% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 020.avi
  67:  21% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 021.avi
   5:  21% Normal   Yes 700.0 MiB  Bobbys/Self Mastery 022.avi
  80:  21% Normal   Yes 696.1 MiB  Bobbys/Self Mastery 023.avi
 ................ truncated ...
Analysis:
 transmission-remote -n 'usrname:pwd' -t 3 -if | sort -k 1.5 -r | head -n 999999 | grep "\<Yes\>"
 Note: above command is entered in a single line. Result is piped to sort, head and grep
 1) transmission-remote  | is the command
 2) -n 'usrname:pwd'  | my log-on user and transmission user is different, you might not need this.
 3) -t 3  | format is -t N.  The Nth download, mine is 3rd so -t 3
 Note: use "transmission-remote -n 'usrname:pwd' -l" to show a list of downloads and their id number to find out the id# for N.
 4)  -if   |  list the files
 5)  sort -k 1.5 -r   |  to sort by %done in reverse order. -k is key 1.5 means field 1at5th character -r reverse
 6) head -n 999999  | head would be top 10. -n N would be Nth number of lines. Here I am only making use of the history feature of linux CLI so that in the future I can just ssh into another session, UP arrow-key edit to head -n 20 for top 20 .... OR simple accept 999999 to list all files/lines
 7) grep "\<Yes\>"  | here again I am making use of CLI shell history again to easily change the Yes to No or others. Remember to use "\<No\>" because "No" would match to "Normal" as well and would list out all files/lines.
Note: part or entire command could also be re-directed to files by using "> file.txt" as follows:
 transmission-remote -n 'usrname:pwd' -t 3 -if > file.txt
 That's all for now!
 Remember to have fun with Linux :)