Simple and practical FTP commands

Source: Internet
Author: User
Tags ftp commands ftp site glob ftp client

Simple and practical FTP commands

FTP is one of the earliest protocols used on the TCP/IP network and the INTERNET. It belongs to the application layer of the network protocol group.

The FTP client can send commands to the server to download files, upload files, and create or change directories on the server.


FTP is often used at work. In fact, it is mainly used to upload and download files. The following lists Common commands:

01. ftp 192.168.0.1# Enter the user name and password to log on to the ftp server

[root@host ~]$ ftp 192.168.0.1Connected to 127.0.0.1.220 (vsFTPd 2.2.2)530 Please login with USER and PASS.530 Please login with USER and PASS.KERBEROS_V4 rejected as an authentication typeName (127.0.0.1:root): ftpuse331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp>
02. ftp> mkdir test# Create a test directory
257 "/d/vas1/ftpuse/test" created
03. ftp> dir# List files and directories, or use the ls-lart command
227 Entering Passive Mode (192.168.0.1,175,195).150 Here comes the directory listing.drwxr-xr-x    2 500      500          4096 Sep 19 07:22 test
04. ftp> cd test# Go To The test directory on the ftp server
250 Directory successfully changed.
05. ftp> LCD/home/test# Locate the local directory
Local directory now /home/test
06. ftp> bin# Two transmission modes: binary ( BinaryOr Bin), Ascii(Default)
200 Switching to Binary mode.
07. ftp> put for. py# Uploading local files to the ftp server
local: for.py remote: for.py227 Entering Passive Mode (192.168.0.1,186,68).150 Ok to send data.226 Transfer complete.277 bytes sent in 0.0038 seconds (71 Kbytes/s)
08. ftp> get cmbscmx.zip# Download the ftp server file to your local computer
local: cmmbscmx.zip remote: cmmbscmx.zip227 Entering Passive Mode (192.168.0.1,168,106).150 Opening BINARY mode data connection for cmmbscmx.zip (1046670 bytes).226 Transfer complete.1046670 bytes received in 2.8 seconds (3.7e+02 Kbytes/s)
09. ftp>! Dir# Viewing local files and directories
python  shell
10. ftp> LCD./python# Go to the next-level directory

11. ftp> cd ..# Go to the upper-level directory

12. ftp>Rename for. py f. py# Renaming a file

13. ftp> deleteFor. py# Deleting an object

14. ftp> rmdir test# To delete a folder, make sure there are no files or folders in it.

15.Ftp> bye# Exit or use the quit command

221 Goodbye.
16. ftp> help# Help: View All commands
Commands may be abbreviated.  Commands are:!               cr              mdir            proxy           send$               delete          mget            sendport        siteaccount         debug           mkdir           put             sizeappend          dir             mls             pwd             statusascii           disconnect      mode            quit            structbell            form            modtime         quote           systembinary          get             mput            recv            suniquebye             glob            newer           reget           tenexcase            hash            nmap            rstatus         traceccc             help            nlist           rhelp           typecd              idle            ntrans          rename          usercdup            image           open            reset           umaskchmod           lcd             passive         restart         verboseclear           ls              private         rmdir           ?close           macdef          prompt          runiquecprotect        mdelete         protect         safe

17. ftp> help rmdir# If you use a specific command, add help

rmdir           remove directory on the remote machine



A simple Ftp command

A lot!
The FTP command line format is: ftp-v-d-I-n-g [host name], where-v displays all the response information of the remote server; -n indicates that ftp automatic logon is disabled ;. n etrc file;-d: Debug;-g: cancel the global file name.

The internal commands used by ftp are as follows (brackets indicate optional ):

1 .! [Cmd [args]: Execute the interactive shell on the local machine and exit to return to the ftp environment, for example :! Ls *. zip.

2. $ macro-ame [args]: Execute macro to define macro-name.

3. account [password]: Provide the password required to access system resources after logging on to the remote system.

4. append local-file [remote-file]: append the local file to the remote system host. If the remote system file name is not specified, the local file name is used.

5. ascii: Use the ascii type transmission method.

6. bell: after each command is executed, the computer rings once.

7. bin: Binary File Transfer Mode.

8. bye: exit the ftp session.

9. case: when using mget, convert uppercase letters in the remote host file name to lowercase letters.

10. cd remote-dir: Enter the remote host directory.

11. cdup: Enter the parent directory of the remote host directory.

12. chmod mode file-name: Set the file-name access mode of the remote host file to mode, for example, chmod 777 a. out.

13. close: interrupt the ftp session with the remote server (corresponding to open ).

14. cr: When a file is transmitted using asscii, the carriage return line is converted into a return line.

15. delete remote-file: delete remote host files.

16. debug [debug-value]: sets the debugging mode to display each command order sent to the remote host, for example, deb up 3. If it is set to 0, the debug is canceled.

17. dir [remote-dir] [local-file]: displays the remote host directory and stores the result in local-file.

18. disconnection: Same as close.

19. form format: sets the file transmission mode to format. The default mode is file.

20. get remote-file [local-file]: transfers the remote-file of the remote host to the local-file of the local hard disk.

21. glob: Set the extension of the mdelete, mget, and mput file names, which is the same as the-g parameter in the command line.

22. hash: A hash symbol (#) is displayed for every 1024 bytes transferred (#).

23. help [cmd]: displays the help information of the ftp Internal Command cmd, for example, help get.

24. idle [seconds]: Set the Sleep timer of the remote server to [seconds] seconds.

25. image: sets the binary transmission mode (the same as binary ).

26. LCD [dir]: Switch the local working directory to dir.

27. ls [remote-dir] [local-file]: displays remote-dir in the remote directory and stores local-file in the local file.

28. macdef macro-name: defines a macro. When an empty row under macdef is encountered, the macro defines the end.

29. mdelete [remote-file]: delete remote host files.

30. mdir remote-files local-file: similar to dir, but multiple remote files can be specified, such as mdir *. o. *. zipoutfile.

31 ...... the remaining full text>

What are common FTP commands?

The ftp command transfers files between a local machine and a remote machine. The general format of this command is as follows:
C:> ftp host name/ip Address

The most common commands are:
Ls to list the current directory of the remote machine
Cd changes the working directory on a remote machine
LCD changes the working directory on the local machine
Set the file transmission mode to ascii in ascii mode.
Set the file transfer mode to binary.
Close to terminate the current ftp session
Each time the hash data is transmitted in the data buffer, A # number is displayed.
Get (mget) transfers specified files from a remote machine to a Local Machine
Put (mput) transfers the specified file from the local machine to the remote machine
Open connection to remote ftp site
Quit disconnects from the remote machine and exits ftp
? Display local help information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.