Chinaunix首页 | 论坛 | 博客
  • 博客访问: 183759
  • 博文数量: 64
  • 博客积分: 1451
  • 博客等级: 上尉
  • 技术积分: 665
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-24 10:07
文章分类

全部博文(64)

文章存档

2010年(7)

2009年(57)

我的朋友

分类: LINUX

2009-11-05 17:09:13

1.如何在命令行登录可匿名登录的ftp服务器
FTP的匿名登录一般有三种:
1) 用户名:anonymous 密码:Email或者为空
2) 用户名:FTP 密码:FTP或者为空
3) 用户名:USER 密码:pass
2.登录ftp服务器后,如果想对本地的文件目录进行操作,不需要再开一个终端,只需要在执行的命令前加一个“!”即可,如:
ftp> ls   #列出了远端服务器上的文件列表
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r--    1 ftp      ftp           245 Aug 03  2001 HEADER.txt
drwx------    2 ftp      ftp             6 Mar 02  2007 lost+found
drwxrwxr-x    8 ftp      ftp            87 Aug 21 01:08 pub
-rw-rw-r--    1 ftp      ftp           243 Jul 19  2007 welcome.msg
226 Directory send OK.
ftp> !ls     #列出本地当前目录下的文件列表
pkglist    scim-helper-manager-socket-cxu        test
3.切换本地当前工作目录
ftp> lcd /home/cxu    #切换本地当前工作目录
Local directory now /home/cxu
ftp> !ls   #列出本地当前目录下的文件列表
Desktop    amsn_received     EOF        man           Public            test            新文件
4.在ftp中使用grep命令
先把当前目录的文件列表存到本地工作目录的pkglist.01中。
ftp> ls . pkglist.01  # ls[remote-dir][local-file]:显示远程目录remote-dir, 并存入本地文件local-file
output to local-file: pkglist.01? yes
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.
ftp> !grep "ppc.rpm" pkglist.01  #加"!",在本地执行grep命令。
-rw-r--r--    1 ftp      ftp         18098 Feb 11  2009 lsb-cmdchk-4.0.0-2.ppc.rpm
-rw-r--r--    1 ftp      ftp        691543 Feb 11  2009 lsb-libchk-4.0.0-2.ppc.rpm
-rw-r--r--    1 ftp      ftp        730210 Feb 11  2009 lsb-qm-2.2-8.lsb4.ppc.rpm
ftp>
其他ftp命令可以查看http://hi.baidu.com/injava/blog/item/56a15c900efe618ca877a4c4.html
5.下载文件到本地
mget remote-file,支持通配符"*"

阅读(2712) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~