`
sundful
  • 浏览: 1231779 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Linux or unix FTP 上传下载实例

 
阅读更多

命令行方式使用FTP实战练习

简单上传下载实例(/*....*/为注释):

先假设有一FTP服务器,FTP服务器:qint.ithot.net,用户名:username   密码:user1234。在本地电脑D:盘创建一个文件夹"qint"。将要上传的文件复制到d:\qint里。通过FTP命令将文件从本地上传,从服务 器下载的步骤如下:

1.“开始”-“运行”-输入“FTP”

2.open qint.ithot.net
/*这一步可以与第一步合并,在“运行”里直接输入"ftp qint.ithot.net"。如果你的FTP服务器不是用的21默认端口,假如端口是2121,那么此步的命令应在后面空格加2121,即“open qint.ithot.net 2121”*/

3.username
/*提示你输入用户名*/

4.user1234
/*提示你输入密码,密码不回显,打完密码后回车即可。如果你的密码输入错误,将不会提示你重新输入,这时你要键入“user”命令,将会出现第三步,你可以重新输入用户名和密码。*/

5.dir
/*你成功登陆后就可以用dir查看命令查看FTP服务器中的文件及目录,用ls命令只可以查看文件。*/

6.mkdir qint
/*在FTP服务器上根目录下建立qint目录。*/

7.cd qint
/*进入目录qint,用“cd 你的目录名”可以进入当前目录的下一级目录,这跟DOS一样。*/

8.bin
/*采用二进制传输。如果你要上传下载,这一步很重要,不先执行这个命令,上传下载会很慢。*/

9.lcd d:\qint
/*定位本地默认文件夹,在前面我事先在D:盘创建的。*/

10.!dir
/*查看本地文件夹中的文件及目录*/

11.put i001.jpg
/*将当前目录(d:\qint)中的文件i001.jpg上传到FTP服务器默认目录。可以用"mput *.*"将所有文件上传到FTP服务器上。*/

12.get d123.jpg
/*将FTP服务器默认目录中的文件d123.jpg下载到当前目录下(d:\qint)。可以用"mget *.*"将所有文件下载到d:\qint*/,或者可以用“mget * ”将文件夹下的所有的目录里的文件下载到指定的文件夹中。(批下载文件,自动下载全部文件, prom 回车,然后用mget),Linux下通过ftp命令实现断点续传, 使用Linux下ftp命令,使用reget替代mget和get命令;(get前最好还用上bin和hash命令,表示二进制文件、显示传输进度); 注:没试验过sftp是否也支持断点续传

13.delete *.*
/*删除目录qint中的所有文件。*/

14.cd ..
/*返回至上一级目录,即根目录。返回上一级目录用“cd ..”要注意,中间有空格。返回根目录用“cd \”。*/

15.mrdir qint
/*删除目录qint。删除目录,在此目录下不能有文件及目录,不然将无法删除。*/

16.bye
/*退出FTP服务器*/

上传下载时特别要注意服务器及本地电脑的当前目录,文件是从哪里到哪里的问题。查看FTP服务器的当前目录命令为pwd,可以用cd命令定位服务器 的目录。可以用lcd命令定位本地电脑的目录。以上实例应用到了采用FTP命令行方式上传下载的最常用命令,你还可以用命令“?”查看更多的命令。

 

MGET Command

HSI Version:

All

Purpose:

Retrieves a copy of a file from HPSS to your local file space on the host system (same as GET command), with interactive prompt to confirm "get" of each file.

Aliases:  

Command Format:

mget[]  [-B | -b] [-C] [-h] [-L ofs path] [-N] [-o] [-O srcofs:sinkofs:length]
                    [-P | -p] [-R | -r] [-S]  [-t] [-U | -u] [path ...] [<<MARKER] 

Options:

-B | -b : backup option. Renames any existing local file by appending "~". (This option may not be used with -L,-t, or -O)

-C : cache purge option. If specified, purge files from HPSS disk cache after a successful get. Normally used only when it's expected that files will only be fetched once (or infrequently), to help optimize disk cache use.

-h : symlink option. If specified, create local symlink if HPSS symlink. If not set, reads through HPSS symlinks when copying files to local filesystem

-L : pathname of a file containing lists of partial file offsets, in the form specified by -O (see below). Multiple entries per line may be specified. -O option(s), if any, are processed before any -L entries

-N : disable auto-scheduling of retrievals. Default is to schedule retrievals in an optimal way so as to minimize HPSS tape mounts

-O : partial file transfer. "srcofs" is the source file offset, "sinkofs" is the sink file offset, "length" is the transfer length. Missing options use defaults (src: 0, sink: 0, length: entire file). "CP" or "0CP" (case-insensitve) can be used to specify "current position". Multiple -O options may be specified, and are processed in order. Offsets may specified with case-insensitive suffixes "k", "kb",etc.

-P | -p : preserve timestamp. Attempts to copy HPSS file's timestamp to local file.

-R | -r : recursively fetch directories

-S : disable staging of the source file (attempts to read directly from tape). Users having trouble retrieving files over 25 GB in size may wish to use the -S option for the get or mget commands. The -S option was added to allow users to disable staging files from tape, specifically for this type of situation.

-t : "re-get" option. Restart a previously failed operation. This is equivalent to "-O sizeof(localfile):sizeof(localfile):0". Note: -t may not be used with -O or -L

-U | -u : update option. Only copy file from HPSS if local file timestamp is older

MARKER : provides sh-style "here"-document syntax for specifying filenames. Lines following the MARKER, which must be the last token on the line, contain pathname (which may include wildcards). The list is terminated by a line containing MARKER as the first token on the line. If -O,-L is specified, offsets apply only to the first file transferred.

Keywords:

 

Usage Notes:

Interactive prompting can be toggled with the PROMPT command.

Example:

mget *

Related Command(s):

 

分享到:
评论

相关推荐

    Linux&unix;大学教程

    Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。 Linux能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承...

    LINUX.UNIX系统编程手册(下册)

    《linux/unix系统编程手册(上、下册)》是介绍linux与unix编程接口的权威著作。linux编程资深专家michael kerrisk在书中详细描述了linux/unix系统编程所涉及的系统调用和库函数,并辅之以全面而清晰的代码示例。...

    Linux/UNIX系统编程手册源码

    Linux/UNIX系统编程手册源码 linux interface source code

    ftp命令详解--linux/unix

    ftp命令的详细讲解,对于经常在linux/unix下进程文件传输的人员是份不错的参考资料。

    Linux与UNIX Shell编程指南.pdf

    Linux与UNIX Shell编程指南.pdf

    Linux与Unix shell编程指南(完整高清版)

    Linux与Unix shell编程指南(完整高清版)Linux与Unix shell编程指南(完整高清版)Linux与Unix shell编程指南(完整高清版)Linux与Unix shell编程指南(完整高清版)Linux与Unix shell编程指南(完整高清版)Linux...

    Linux-UNIX系统编程手册.pdf

    该资源是很好的学习Linux/Unix编程的手册,看豆瓣书评挺高的就先自己下载看一下,防止自己的文件意外删除,先放到CSDN上,一来可以做一个备份,二来有需要的也可以自己下载(分享才能更好的成长)

    LINUX+UNIX设计思想

    《Linux\Unix设计思想/图灵程序设计丛书》内容简介:将Linux的开发方式与Unix的原理有效地结合起来,总结出Linux与Unix软件开发中的设计原则。《Linux\Unix设计思想/图灵程序设计丛书》前8章分别介绍了Linux与Unix中...

    LINUX_UNIX设计思想

    ”有别于市面上的其他关注如何使用Linux的书籍,《Linux/Unix设计思想》讲述的是“Linux的思维方式”,揭示了Linux正是Unix这一无所不能的操作系统的完美实现。到目前为止,没有一本书同时介绍Unix和Linux的设计理念...

    LINUX与UNIX SHELL编程指南

    LINUX与UNIX SHELL编程指南

    Linux and Unix Shell Programming

    If you are new to UNIX and Linux or if you are a power user in waiting then this book is for you. Most shell programming books merely annotate manual pages and syntax , but in this book users of all ...

    ftp.rar_FTP unix_c ftp_ftp c linux_linux_unix c

    FTP客户端源程序。此程序经测试,可以在winndows,linux,unix跨平台使用

    unix/linux ftp 客户端类

    按照rfc协议将常用的几个ftp命令封装成一个类,方便与ftp服务器交互。 使用方法: setPort connect changeDir dir downloadFile uploadFile

    Linux环境下socket编程,实现简单的FTP上传下载功能

    Linux环境下socket编程,实现简单的FTP上传下载功能

    精通 LINUX & UNIX Shell 程序设计.pdf 高清下载

    精通 LINUX & UNIX Shell 程序设计.pdf

    Linux/UNIX系统编程手册课后习题代码

    Linux/UNIX系统编程手册课后习题代码 linux-programming-interface-exercises

    linux/unix系统编程手册附录代码

    linux/unix系统编程手册附录代码,适用于想提高自己linu水平以及对linux感兴趣的的同学去参考阅读

    Linux-Unix设计思想

    将Linux的开发方式与Unix的原理有效地结合起来,总结出Linux与Unix软件开发中的设计原则。《Linux\Unix设计思想/图灵程序设计丛书》前8章分别介绍了Linux与Unix中9条基本的哲学准则和10条次要准则。第9章和第10章将...

Global site tag (gtag.js) - Google Analytics