首页 > 系统相关 >ubuntu ftp 基本FTP命令 Basic FTP Commands

ubuntu ftp 基本FTP命令 Basic FTP Commands

时间:2023-03-28 22:33:37浏览次数:38  
标签:files FTP Commands ftp command file directory


You can use FTP to transfer files from your Mac OS X Snow Leopard computer with an FTP server by using the command-line interface (CLI); to use the CLI, open a Terminal, or shell, session. To use a Terminal session, double -click

After you’re in the Terminal session, you’ll use a series of commands to connect to another computer, move in and out of folders, and transfer files. Following is a list of the basic commands that you need to use FTP as well as a brief description of what each command does.

 

  • ftp This command starts the FTP command line interface session. You can tell that you’re in the FTP client application when you see ftp>
  • open : This command is used to start your connection to another computer. Type this command followed by the IP address of the FTP server that you want to connect to.
  • ls : Use this command to see a listing of all files and folders in the current folder on the FTP server.
  • cd : This command allows you to change the folder that you’re in. Type cd <folder> (where folder is a specific folder name) to move into a subfolder on the FTP server. Type cd .. (that’s c, d, space, and two periods) to go back out a folder level.
  • lcd : This command acts exactly like cd
  • bin : Type this command to get in binary mode to transfer files that aren’t plain-text files. (Always use binary mode unless you’re specifically transferring plain-text files.)
  • ascii : This command puts you in ASCII mode for transferring text files.
  • get ormget : To retrieve a single file, use the get command followed by the filename of the file that you want to retrieve. If you want to get multiple files at one time, use the mget command followed by a filename, possibly containing * and/or ?
  • put ormput : To send a single file, use the put command followed by the filename to send a file to the FTP server. To send multiple files, use the mput command followed by a filename, possibly containing * and/or ?
  • quit : Use the quit

To end a Terminal session and exit Terminal at any time, press Command+Q. Terminal prompts you for confirmation if necessary.

 

Using these commands will enable you to exchange files with an FTP server. Here’s an example of how to use these commands within the Terminal window:

 

  1. Type ftp
  2. Type open <ip address> (where ip address is the server’s network IP address) to open your connection to the FTP server.
  3. At this point, you’re asked for a username and password.
    For many FTP servers, using the username anonymous and your e-mail
  4. Type lcd <folder> (where folder
  5. Type the ls and cd
  6. Type the ascii or bin
    This is important because choosing the wrong type will likely cause the transfer to fail. Unless it’s a plain-text file, always use binary mode.
  7. Type the get , mget , put , and mput
  8. Type the quit

 

The FTP site of the Computer Science department at CSU requires the user to use sftp, the secure version of FTP. Just type sftp instead of ftp, when you are using FTP in a terminal window.

 

EXAMPLES

 ftp abc.xyz.edu
This command will attempt to connect to the ftp server at abc.xyz.edu. If it succeeds, it will ask you to log in using a username and password. Public ftp servers often allow you to log in using the username "anonymous" and your email address as password. Once you are logged in you can get a list of the available ftp commands using the help function:

 ftp> help
This lists the commands that you can use to show the directory contents, transfer files, and delete files.

 ftp> ls
This command prints the names of the files and subdirectories in the current directory on the remote computer.

 ftp> cd customers
This command changes the current directory to the subdirecotry "customers", if it exists.

 ftp> cd ..
Changes the current directory to the parent direcotry.

 ftp> lcd images
Changes the current directory on the local computer to "images", if it exists.

 ftp> ascii
Changes to "ascii" mode for transferring text files.

 ftp> binary
Changes to "binary" mode for transferring all files that are not text files.

 ftp> get image1.jpg
Downloads the file image1.jpg from the remote computer to the local computer. Warning: If there already is file with the same name it will be overwritten.
 ftp> put image2.jpg
Uploads the file image2.jpg from the local computer to the remote computer. Warning: If there already is file with the same name it will be overwritten.

 ftp> !ls
A '!' in front will execute the specified command on the local computer. So '!ls' lists the file names and directory names of the current directory on the local computer.

 ftp> mget *.jpg
With mget you can download multiple images. This command downloads all files that end with ".jgp".

 ftp> mput *.jpg
Uploads all files that end with ".jgp".

 ftp> mdelete *.jpg
 Deletes all files that end with ".jgp".

ftp> prompt
Turns iteractive mode on or off so that commands on multiple files are executed without user confirmation.

ftp> quit
Exits the ftp program.

 

来源:http://linux.about.com/od/commands/l/blcmdl1_ftp.htm

 

 

Common FTP Commands

?     to request help or information about the FTP commands

ascii     to set the mode of file transfer to ASCII (this is the default and transmits seven bits per character)

binary     to set the mode of file transfer to binary (the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files)

bye     to exit the FTP environment (same as quit)

cd     to change directory on the remote machine

close     to terminate a connection with another computer
close brubeck     closes the current FTP connection with brubeck, but still leaves you within the FTP environment.
delete     to delete (remove) a file in the current remote directory (same as rm in UNIX)
get     to copy one file from the remote machine to the local machine
get ABC DEF     copies file ABC in the current remote directory to (or on top of) a file named DEF in your current local directory.
get ABC     copies file ABC in the current remote directory to (or on top of) a file with the same name, ABC, in your current local directory.
help     to request a list of all available FTP commands
lcd     to change directory on your local machine (same as UNIX cd)
ls     to list the names of the files in the current remote directory
mkdir     to make a new directory within the current remote directory
mget     to copy multiple files from the remote machine to the local machine;  you are prompted for a y/n answer before transferring each file
mget *     copies all the files in the current remote directory to your current local directory, using the same filenames. Notice the use of the wild card character, *.
mput     to copy multiple files from the local machine to the remote machine; you are prompted for a y/n answer before transferring each file
open     to open a connection with another computer
open brubeck     opens a new FTP connection with brubeck;  you must enter a username and password for a brubeck account  (unless it is to be an anonymous connection).
put     to copy one file from the local machine to the remote machine
pwd     to find out the pathname of the current directory on the remote machine
quit     to exit the FTP environment (same as bye)
rmdir     to to remove (delete) a directory in the current remote directory

 

标签:files,FTP,Commands,ftp,command,file,directory
From: https://blog.51cto.com/u_8895844/6155509

相关文章

  • 具有FTP、FTPS和sftp功能的文本编辑器——EditPlus功能介绍
    ​EditPlus是Windows的文本编辑器,具有内置的FTP、FTPS和sftp功能。虽然它可以很好地替代记事本,但它也为网页作者和程序员提供了许多强大的功能。 功能特征01、语法高......
  • ftp服务
    ftp服务FTP服务器是在互联网/局域网上提供文件存储和访问服务的计算机,它们依照FTP协议提供服务。模式:C/S模式端口:21(用于建立控制连接,并传输指令),20(用于建立数据连接,并......
  • Windows启动一个FTP站点,让局域网的人访问/写
      现在需要一台局域网的电脑启动一个ftp站点,该电脑需要进行以下步骤:https://blog.csdn.net/m0_50298323/article/details/128404598   ......
  • VsCode SFTP插件
    ......
  • Android平板替代FTP服务器实战
     完了,公司的FTP服务器挂了。 挂了就挂了,不需要我等草民去管。 当务之急就是找台机器去顶替下。 问题是买台服务器要钱。 好在公司源代码和开发工具不大,自己做个F......
  • 远程挂载sftp
    1.A机器上启用sftp,编辑/etc/ssh/sshd_configSubsystemsftpinternal-sftpCiphersaes256-ctr,aes192-ctr,aes128-ctrMatchGroupsftpChrootDir......
  • Windows10上怎样开启FTP服务
    场景FTP服务器(FileTransferProtocolServer)是在互联网上提供文件存储和访问服务的计算机,它们依照FTP协议提供服务。FTP是FileTransferProtocol(文件传输协议)。顾名思......
  • 关于 ssh ftp tftp nfs 的作用。
          但是我觉得这几类本质上是一样的。 都是利用了网络。比如说,ssh可以远程访问,这不就可以当做网络文件系统了吗?可能只需要在源码中稍微改......
  • tftp升级程序
    ●输入命令setenvserverip10.10.10.115setenvipaddr10.10.10.166setenvnetmask255.255.0.0setenvgatewayip10.10.0.1setenvethaddr68:22:33:BA:28:11(一般不需......
  • 使用FileZilla Server基于NAS共享搭建FTP Server
    客户有需求想通过FTP访问NAS的一个共享目录,是一台windows系统的服务器,基于CIFS.尝试了很多次都有问题,我在公司的测试环境也尝试了,同样遇到错误:经过排查和不懈努力研究,看到外......