通常linux服务器是通过ssh客户端来进行远程登录和管理的。
然而如何方便的实现客户端与linux服务器端的文件交互呢?
rz,sz是Linux/Unix同Windows进行ZModem文件传输的命令行工具
优点:比ftp命令方便,而且服务器不用打开FTP服务。
首先先了解有关的两个命令可以提供很方便的操作:
rz:运行该命令会弹出一个文件选择窗口,从本地选择文件上传到Linux服务器
sz:将选定的文件发送(send)到本地机器
在Ubuntu下安装rz、sz有2个方法,分述如下:
方法1:自动安装
1.1 在终端中,输入命令:
sudo apt-get install lrzsz
方法2:手动安装
2.1 下载
地址:http://www.ohse.de/uwe/software/lrzsz.html
下载到一个压缩包文件:lrzsz-0.12.20.tar.gz
2.2 解压 安装 创建连接
tar xvf lrzsz-0.12.20.tar.gz ls -l cd lrzsz-0.12.20/ ./configure make sudo make install linux@ubuntu:/usr/local/bin$ which lrz /usr/local/bin/lrz linux@ubuntu:/usr/local/bin$ which lrz /usr/local/bin/lrz
/usr/bin/install -c -m 644 ./lrz.1 /usr/local/man/man1/lrz.1 /usr/bin/install -c -m 644 ./lsz.1 /usr/local/man/man1/lsz.1 make[2]: Leaving directory `/home/linux/linux_c/rzsz/lrzsz-0.12.20/man' make[1]: Leaving directory `/home/linux/linux_c/rzsz/lrzsz-0.12.20/man' Making install in testsuite make[1]: Entering directory `/home/linux/linux_c/rzsz/lrzsz-0.12.20/testsuite' make[1]: Leaving directory `/home/linux/linux_c/rzsz/lrzsz-0.12.20/testsuite' linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ which sz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ which rz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ which lrz /usr/local/bin/lrz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ which lrz /usr/local/bin/lrz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ sudo ln -s /usr/local/bin/lrz rz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ sudo ln -s /usr/local/bin/lsz sz linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ which rz
创建连接 linux@ubuntu:~/linux_c/rzsz/lrzsz-0.12.20$ cd /usr/local/bin/ linux@ubuntu:/usr/local/bin$ sudo ln -s /usr/local/bin/lsz sz linux@ubuntu:/usr/local/bin$ sudo ln -s /usr/local/bin/lrz rz linux@ubuntu:/usr/local/bin$ which rz /usr/local/bin/rz linux@ubuntu:/usr/local/bin$ which sz /usr/local/bin/sz
linux@ubuntu:/usr/local/bin$ file lrz lrz: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xb8a908d8cc1b5830a01d02164cabd1d8d3b8e1ae, not stripped linux@ubuntu:/usr/local/bin$ file lsz lsz: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xe1cd785268178b552b3a17ef77fc7441b47023c3, not stripped |
现在使用ubuntu虚拟机代替开发板进行测试lrz lsz命令
Lrz 虚拟机中启动该命令 从主机(windows)中下载文件,下载的目录是当前ubuntu目录
Lsz 虚拟机中启动该命令 从虚拟机 ubuntu中上传文件,上传的默认目录设置在securecrt中
使用securt登陆ubuntu虚拟机 linux@ubuntu:~$ lsz lsz: need at least one file to send Try `lsz --help' for more information. linux@ubuntu:~$ lsz testfile rz Starting zmodem transfer. Press Ctrl+C to cancel. Transferring testfile... 100% 19 KB 19 KB/sec 00:00:01 0 Errors 测试接收文件bom.xlsx... schcvt.log. linux@ubuntu:~/linux_c$ lrz lrz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. Transferring bom.xlsx... 100% 12 KB 12 KB/sec 00:00:01 0 Errors
linux@ubuntu:~/linux_c$ ls -l total 3332 -rwxrwxr-x 1 linux linux 8042 Aug 19 20:17 a.out -rwxrwxr-x 1 linux linux 7002 Aug 14 17:25 app.elf -rw-r--r-- 1 linux linux 12288 Aug 11 14:47 bom.xlsx -rwxrwxr-x 1 linux linux 928 Aug 14 16:57 cident.sh -rwxrwxr-x 1 linux linux 84906 Aug 19 20:19 iperf drwxr-xr-x 8 linux linux 4096 Aug 19 20:18 iperf-2.0.5 -rwxrwxr-x 1 linux linux 248583 Aug 19 19:44 iperf-2.0.5-source.tar.gz -rwxrwxr-x 1 linux linux 474 Aug 14 16:57 makefile drwxrwxr-x 4 linux linux 4096 Aug 20 13:59 rzsz -rwxrwxr-x 1 linux linux 1296852 Aug 14 17:14 strace -rw-rw-r-- 1 linux linux 601856 Aug 14 16:18 strace-4.10.tar.xz -rwxrwxr-x 1 linux linux 1123048 Aug 14 17:08 strace.dyn -rw-rw-r-- 1 linux linux 88 Aug 14 17:16 test.c linux@ubuntu:~/linux_c$ lrz lrz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. Transferring schcvt.log... 100% 3 KB 3 KB/sec 00:00:01 0 Errors linux@ubuntu:~/linux_c$ ls -l total 3336 -rwxrwxr-x 1 linux linux 8042 Aug 19 20:17 a.out -rwxrwxr-x 1 linux linux 7002 Aug 14 17:25 app.elf -rw-r--r-- 1 linux linux 12288 Aug 11 14:47 bom.xlsx -rwxrwxr-x 1 linux linux 928 Aug 14 16:57 cident.sh -rwxrwxr-x 1 linux linux 84906 Aug 19 20:19 iperf drwxr-xr-x 8 linux linux 4096 Aug 19 20:18 iperf-2.0.5 -rwxrwxr-x 1 linux linux 248583 Aug 19 19:44 iperf-2.0.5-source.tar.gz -rwxrwxr-x 1 linux linux 474 Aug 14 16:57 makefile drwxrwxr-x 4 linux linux 4096 Aug 20 13:59 rzsz -rw-r--r-- 1 linux linux 3080 Jul 15 14:37 schcvt.log -rwxrwxr-x 1 linux linux 1296852 Aug 14 17:14 strace -rw-rw-r-- 1 linux linux 601856 Aug 14 16:18 strace-4.10.tar.xz -rwxrwxr-x 1 linux linux 1123048 Aug 14 17:08 strace.dyn -rw-rw-r-- 1 linux linux 88 Aug 14 17:16 test.c
|
那开发板中怎么测试呢?就得先把lrz lsz交叉编译成mt7688 可执行文件,并下载到开发板中,后面的操作就跟前面是一致的了。
但是,源码包不是上的那个,而是rzsz-3.48.tar.gz
参考http://blog.csdn.net/mlks_2008/article/details/12297969