March 2008 Archives

Mon Mar 17 15:16:10 CDT 2008

Using ls or du to check progress on remote bittorrent download.

your first impulse might be to make a GUI connection with VNC or some other remote desktop software. If you've ever tried this, you'll remember how painfully slow the connection can be when your torrent has your connection maxed out. After you authenticate, you have to see the screensaver for a second before it fades away, click to the right desktop, find the right window, and finally you can see your progress. Each step takes several seconds while you wait for the screen to load. Not to mention the fact that you're chewing into your bandwidth and hurting your transfer.

The better way to do this: ssh. With ssh, you use almost no bandwidth. You can easily navigate to your download directory and check file size in a few seconds. Which tool you use will depend on the way your bittorrent client creates the file. Some clients reserve space for the entire file when you start while others build the file as data comes in.

If your client reserves the space when the download starts, the ls command will say you have the entire file. The only clue you'll have is file date: it will continually update even though the size stays the same. To see how much space is actually being used on the disk, use the du command.

For example, du -sh ~/OperaDownloads/*
This code will list the size of each file and folder in OperaDownloads.

You can test the difference with a sparse file. You can easily create one with this command:
dd if=/dev/zero bs=1k count=1 seek=`expr 1024 \* 4096` of=~/sparse.file
You will now have a 4GB "empty" file. file calls it data, ls -lh calls it 4gb, but du and df know the truth. Just for fun, you can tar.gz your sparse file and see just how small it is: tar -czf sparse.tgz sparse.file

Posted by Nesman | Permanent Link