设为首页 收藏本站
查看: 899|回复: 0

[经验分享] FTP命令简介

[复制链接]

尚未签到

发表于 2016-6-7 11:08:44 | 显示全部楼层 |阅读模式
<!--[if IE]>
<?XML:NAMESPACE PREFIX = GDOC />
<![endif]-->              FTP Guide

A short guide to using FTP
============================

# FTP (short for File Transfer Protocol) is extremely useful for transferring
# files to and from another site.

# Usage:
% ftp site_name
(enter user id)
(enter user password)  

# Example:
% ftp gantt.stanford.edu
ftp> Connected to gantt.stanford.edu
220 gantt.stanford.edu FTP server (Version 4.187 Wed Nov 28 17:08:58 EST 1990) ready.
Name (cn.ecn.purdue.edu:aec99): aec99
331 Password required for aec99.
Password: xxxxxxxx
230 User aec99 logged in.
ftp>                         ... and you are in.

# Usage (commands):
ftp> ls         <- to list files in foreign host.
ftp> dir        <- to list files in foreign host including date, size, etc.
ftp> !command   <- to run commands at the host you are on., e.g. !ls
ftp> cd         <- to change directory
ftp> asc        <- to set to text mode for transfer (for text files only)
ftp> bin        <- to set to binary mode for transfer (for everything else - reccommended)
ftp> bye        <- to exit

# Transferring files:
# To transfer a file, use 'get' and 'send'. In the case of a binary file, the
# command 'bin' has to be typed first to prepare the host to receive the file.
# If not, strange things happen... (to the file, that is). Text file can be
# transferred without problem using either text or binary modes.

# Usage:
ftp> get file_name    (getting a text file)

ftp> send file_name   (sending a text file)

ftp> bin              (getting a binary file, e.g. xxx,gif, xxx.exe, elm, etc)
221 set type to I    <- host response
ftp> get file_name

ftp> bin              (sending a binary file)
ftp> send file_name

# Sometimes, mass retrieval can be done by using 'mget'

# Usage:
ftp> mget wild_card

# Example:
ftp> mget new*        (to get any file which start with 'new'.)

# To exit...
ftp> bye

# Publuc-access FTP-sites:
# There are a number of public-accessible FTP-sites around InterNet. Many of
# them contain useful softwares (and even games and nice GIFs!). These sites
# can be accessed as the following:

% ftp site_name
(user login:) anonymous
(user password/guest ID:) your own LOGIN@MACHINE

# Example:
% ftp ftp.cica.indiana.edu
ftp> Connected to ftp.cica.indiana.edu.
220 ftp FTP server (Version 6.16 Thu May 7 14:43:04 EST 1992) ready.
Name (ftp.cica.indiana.edu:wai): anonymous    <------
331 Guest login ok, send e-mail address as password.
Password: wai@sage.cc.purdue.edu              <------
230-**
230-**  You have reached ftp.cica.indiana.edu [129.79.20.84] at
230-**  the Center for Innovative Computer Applications (CICA) at
230-**  Indiana University in Bloomington, Indiana USA.
230-**  .... [lost of intro deleted]
230-**
230-
230 Guest login ok, access restrictions apply.
ftp>

# Here is a short list of only few of the many FTP-sites around:

# ftp.cica.indiana.edu                 - Win3 drivers & programs
# me.uta.edu                           - Engineering programs
# media-lab.media.mit.edu      18.85.0.2 Misc items
# monu6.cc.monash.edu.au  130.194.32.106 PC softwares + Win3 drivers & programs
# pit-manager.mit.edu                  - Usenet infos, newsgroups faqs, etc.
# procyon.cis.ksu.edu                  - PC softwares and MS-DOS based Unix progs.
# utsun.s.u-tokyo.ac.jp     133.11.11.11 Misc items.
# uxc.cso.uiuc.edu          128.174.5.50 Misc usenet items.
# wuarchive.wustl.edu      128.252.135.4 Misc MS-DOS items.
# garbo.uwasa.fi                       - PC and Windows softwares (good)

# Have fun!

==================================================================================================================

HOW TO FTP A FILE:

Here are the steps you use to ftp a file.
rev. vmv 5/27/99
rev. vmv 03/01/01
rev. vmv 04/11/01

A)  TO FTP TO A NODE ON WHICH YOU HAVE AN ACCOUNT:
FOR WINCENTER ACCOUNT TO UNIX, or
FOR WINCENTER TO WINCENTER, GO TO (1)
FOR AN ANONYMOUS LOGIN, GO TO (2)

In a window, cd to the directory where you want the files to be put in,
in your account.  Or where the files are that you are sending to another
account.

> cd myspecialdir
> ftp nodename                        (ftp cadwhs01)

login with username and password(you have to have an account on the
node that you are getting a file from
or access privileges unless it is an
anonymous account.

1)  FOR WINCENTER TO UNIX or WINCENTER TO WINCENTER

Start up the Citrix ICA Client for IRIX

% wincenter

Go to Entry/Connect
OK
Go to the Start Button/Programs/Command Prompt
cd to the directory you want the files to either go to or go from.

EXAMPLE:
U:/users/vivianv> cd PPDPamphlet
U:/users/vivianv/PPDPamphlet> ftp cadwhs01 (UNIX server where my account is)
User (cadwhs01.fnal.gov:(none)): vivianv
Password required for vivianv
Password ************
User vivianv logged in.

ftp> cd dirwhere_the_files_are_located_or_copied_to

ftp> get name_of_file.ps  OR
ftp> put name_of_file.ps

* Note when transferring files:
Drafting files need to be sent binary so you must specify "bin" before
the transfer.  Text files are send "ascii", postscript doesn't matter.

* If you receive an error when ftping from wincenter to wincenter, you
will have to transfer your files from your first wincenter account to
an area on your UNIX account initially, and then ftp them from your
second wincenter account from the UNIX account.
-----------------------------------------------------------------------------
2)  TO FTP TO A NODE WITH AN ANONYMOUS LOGIN:

> cd myspecialdir
> ftp ftp.sdrc.com(the anonymous site)

login in with "anonymous" and the password is your email address
ie.  jimbo@fnal.gov

Once in, you can cd to the directory where the files are you are trying to
get or send.  You can do a dir to see where you are and where you want to go.

Once you are in the proper directory or area the following tells the proper
syntax that should be used when transferring file.
-----------------------------------------------------------------------------
A)  IF YOU ARE GETTING ONE FILE:

ftp> cd dirname         (cd to the directory where you are to get your file, like "pub")
ftp> bin(makes sure all transfers are in binary format)
(the only thing that uses ascii is a text file)
ftp> get filename (ie. get assembly.dwg)

IF YOU ARE GETTING LOTS OF FILES:

ftp> bin
ftp> mget *.dwg(it will ask you if you want to get each file
individually and you type either y or n.
-----------------------------------------------------------------------------
B)  IF YOU ARE SENDING ONE FILE:

ftp> cd dirname         (cd to the directory where you are to put your file, like "pub")
ftp> bin
ftp> put filename       (ie. put tankassy.dwg)
-----------------------------------------------------------------------------
C)  IF YOU ARE SENDING LOTS OF FILES:

ftp> bin
ftp> mput *.ps          (put the extension of the files that you are putting in or
(use * if there are too many different kinds)

NOTE:
You can specify the file be named differently in your unix account if
you are getting from an NT or PC.  They typically have names that
unix doesn't like, like assy$1.dwg or assy&hgr.dwg or name with spaces,
like Hanger and Assy.dwg.  Unix recognizes symbols as what is used
for script writing and programming and is unable to parce spaces.

INSTEAD USE THIS SYNTAX:

ftp> bin
ftp> get filename newfilename(get assy$1.dwg assembly1.dwg)
to change the file name when it is copying to your account.

*DO NOT USE mget THIS WAY, IT DOESN'T WORK.
-----------------------------------------------------------------------------
D) TO QUIT:

ftp> ftp quit
-----------------------------------------------------------------------------
EXAMPLE:

You are sending an archive file to sdrc because you can't read it or
there is some other problem.  They tell you the name of their ftp site
is:
"ftp.sdrc.com", your username is
"customer" and your password is
"dirtft2p"
and to put your archive file in the directory named
"incoming".
Here are the steps you would take.

> ftp ftp.sdrc.com
> customer
> dirtft2p
ftp> cd incoming
ftp> bin
ftp> put scrambled_shaded_tube.arc
ftp> quit

=================================================================================================================

ASCII Mode & Binary Mode

FTP has two modes to transfer files: ASCII mode and Binary mode.


ASCII is a 7bit format, the last bit is always 0, and so only 7 bits
are transferred in ASCII mode the 0 being appended to create the full
byte.


In binary mode this is not the case and all 8 bit are transferred. If
the file bing transferred was ASCII to begin with you won't see a
problem, but if you transfer a binary as ascii it will become corrupted.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-227375-1-1.html 上篇帖子: FTP基础知识 下篇帖子: java ftp client
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表