FTP on Linux and other Unix systems allows you to pass shell commands to the ftp client by using the pipe symbol ‘|’ as the first character of the file name. With this feature you can send a very large file to a remote host using /dev/zero as input and /dev/null as output.
Example:
ftp> put “|dd if=/dev/zero bs=1M count=100″ /dev/null
This command transfers a large file without involving the disk and without having to cache the file in memory. If you use a large file on a disk it might become a bottleneck. In this example, “|dd if=/dev/zero bs=1M count=100″ becomes the input file. Since a dd command without the “of=” paramater prints the content of the file to standard output (stdout), the ftp client can read the output and pass it on to the remote file which is /dev/null on the remote host.
0 comments:
Post a Comment