Linux terminal access FTP and upload download files __linux

Source: Internet
Author: User
Tags auth dba ftp connection mkdir
 Category: Linux 2010-08-17 17:58 25443 people read Comments (0) Favorites Report Linux terminal user Oracle command FTP server

Today, my colleague asked me a question, access FTP under Linux, and upload the file. I've been using the WinSCP tool before. First file from Linux Copy to Windows, and then upload to FTP. Google a bit. Method is also relatively simple. This is only discussed through terminals, because it can also be done via IE or other tools.

1. Linux Terminal Connection FTP

[Oracle@dave ~]$ FTP 10.85.7.97

Connected to 10.85.7.97.

Serv-u FTP Server v6.4 for WinSock ready ...

' AUTH ': Command not understood.

' AUTH ': Command not understood.

Kerberos_v4 rejected as an authentication type

Name (10.85.7.97:oracle): Super

331 User name Okay, need password.

Password:-Linux password is not echo

230 User logged in, proceed.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp>

If FTP allows anonymous users, then the user name to enter anonymous, password arbitrary. You can't just hit enter.

2. View FTP command

Ftp>?

Commands may be abbreviated. Commands are:

! CR Mdir Proxy Send

$ delete mget SendPort site

Account Debug mkdir put size

Append dir mls pwd status

ASCII disconnect mode quit struct

Bell Form Modtime Quote System

Binary get mput recv sunique

Bye Glob newer Reget Tenex

Case Hash Nmap Rstatus Trace

CCC Help Nlist Rhelp type

CD Idle Ntrans rename user

Cdup Image Open Reset Umask

chmod LCD Passive Restart verbose

Clear LS private rmdir?

Close Macdef Prompt Runique

Cprotect Mdelete Protect Safe

A description of each command can be viewed through the help command

Ftp> help put

Put send one file

Ftp> Help Mput

Mput Send multiple Files

3. Upload file

Putting command: Format: Put local-file [remote-file] Upload a file to FTP

Mput command: Format: mput local-files transfer a batch of files from a local host to a remote host.

Note: The mput command can only upload files from the current local directory to the current directory on FTP. For example, the FTP command that runs under/root/dave, only the file Linux under/root/dave will be uploaded to the current directory on the server.

Put code example:

ftp> pwd--Displays the current path on the FTP

257 "/" is current directory.

Ftp> LS--Displays the files in the current directory

Entering passive Mode (10,85,7,97,16,141)

Opening ASCII mode data connection For/bin/ls.

Drw-rw-rw-1 User Group 0 Aug 17 16:11.

Drw-rw-rw-1 User Group 0 Aug 17 16:11.

-rw-rw-rw-1 User Group 1433088 Feb 5 Aspajaxextsetup_pconline_pconline.msi

-rw-rw-rw-1 User group 197626837 Mar 8 10:00 delphiv7.0.zip

DRW-RW-RW-1 User Group 0 June 9 10:17 HHT

-rw-rw-rw-1 user group 9235148 DEC 2009 Install_hskey_v1.3.exe

-rw-rw-rw-1 user group 47316992 may 16:38 Release_4.rar

Ftp> mkdir Dave--Create a folder Dave

257 "/dave" directory created.

Ftp> CD Dave--access folder Dave

Directory changed To/dave

ftp> pwd--Displays the current directory

257 "/dave" is current directory.

Ftp> LCD--Displays the current local path, and we can upload this file from this path to the FTP server relative location

Local Directory Now/home/oracle

Ftp>! --Exit the current window, return to the Linux terminal, when we exit the terminal, it will return to the FTP.

[Oracle@dave ~]$ LS--Displays the files in the current directory

Dead.letter Scripts Sqlnet.log

[Oracle@dave ~]$ VI Dave--Create a file Dave

[Oracle@dave ~]$ VI DBA--Creating a file dBA

[Oracle@dave ~]$ LS--Displays the contents of the folder, etc, we will copy these files to FTP

Dave DBA Dead.letter Scripts Sqlnet.log

[Oracle@dave ~]$ Exit--Exit terminal, return FTP command line

Exit

ftp> LCD

Local Directory Now/home/oracle

Ftp> put DBA dba-upload the file dba you just created to the current directory of FTP and name it DBA.

LOCAL:DBA REMOTE:DBA

Entering passive Mode (10,85,7,97,16,156)

Opening BINARY mode data connection for DBA.

Transfer complete.

5 bytes Sent in 3.3e-05 seconds (1.5e+02 kbytes/s)

Ftp> put DBA/DAVE/SFDBA--upload the file DBA you just created to the current directory of FTP and rename it to SFDBA.

LOCAL:DBA Remote:/DAVE/SFDBA

Entering passive Mode (10,85,7,97,16,158)

Opening BINARY mode data connection for SFDBA.

Transfer complete.

5 bytes Sent in 1.8e-05 seconds (2.7e+02 kbytes/s)

Ftp> PUT/HOME/ORACLE/DBA/TEST/SFDBA

Local:/HOME/ORACLE/DBA Remote:/TEST/SFDBA

Entering passive Mode (10,85,7,97,16,163)

Opening BINARY mode data connection for SFDBA.

Transfer complete.

5 bytes Sent in 2.2e-05 seconds (2.2e+02 kbytes/s)

Ftp> CD Test

Directory changed to/test

Ftp> ls

Entering passive Mode (10,85,7,97,16,169)

Opening ASCII mode data connection For/bin/ls.

Drw-rw-rw-1 User Group 0 Aug 17 17:11.

Drw-rw-rw-1 User Group 0 Aug 17 17:11.

-rw-rw-rw-1 User Group 5 Aug 17:11 SFDBA

-rw-rw-rw-1 user group 5508 Aug 16:21 Sqlnet.log

Transfer complete.

mput Sample code:

Ftp> CD Dave

Directory changed To/dave

Ftp> Mput *

Mput alert_log.txt? --Every file is confirmed here, press Enter is OK.

Entering passive Mode (10,85,7,97,16,196)

Opening BINARY mode data connection for Alert_log.txt.

Transfer complete.

712 Bytes sent in 2.9e-05 seconds (2.4e+04 kbytes/s)

Mput alert_newccs.hist?

Entering passive Mode (10,85,7,97,16,197)

Opening BINARY mode data connection for alert_newccs.hist.

Transfer complete.

9321666 bytes sent in 0.78 seconds (1.2e+04 kbytes/s)

Mput Alert_newccs.log?

Entering passive Mode (10,85,7,97,16,198)

Opening BINARY mode data connection for Alert_newccs.log.

Transfer complete.

21707 bytes sent in 0.0014 seconds (1.5e+04 kbytes/s)

Ftp> LS--Displays the files in the directory

Entering passive Mode (10,85,7,97,16,217)

Opening ASCII mode data connection For/bin/ls.

Drw-rw-rw-1 User Group 0 Aug 17 17:22.

Drw-rw-rw-1 User Group 0 Aug 17 17:22.

-rw-rw-rw-1 User Group 5 Aug 17:09 SFDBA

-rw-rw-rw-1 User Group 712 Aug 17:21 Alert_log.txt

-rw-rw-rw-1 user group 9321666 Aug 17:21 alert_newccs.hist

-rw-rw-rw-1 user group 21707 Aug 17:21 Alert_newccs.log

Transfer complete.

ftp> Delete sfdba--delete sfdba file

DELE command successful.

Ftp> Mdelete A *--bulk Delete files

Mdelete alert_log.txt? --Every file has to be confirmed.

DELE command successful.

Mdelete alert_newccs.hist?

DELE command successful.

Mdelete Alert_newccs.log?

DELE command successful.

4. Download the file

There are also 2 commands: Get and mget. Mget users to bulk download.

Format: Get [Remote-file] [Local-file]

Mget [Remote-files]

Similarly, mget downloads files to the local current directory.

Get Example:

Ftp> GET/TEST/SFDBA/HOME/SFDBA

Local:/HOME/SFDBA Remote:/TEST/SFDBA

Local:/home/sfdba:permission denied--linux very strict control of the permissions, download the corresponding folder Write permission

Ftp> GET/TEST/SFDBA/HOME/ORACLE/SFDBA

Local:/HOME/ORACLE/SFDBA Remote:/TEST/SFDBA

Entering passive Mode (10,85,7,97,17,0)

Opening BINARY mode data connection for SFDBA (5 Bytes).

Transfer complete.

5 bytes received in 6.2e-05 seconds (KBYTES/S)

Ftp>!

[Oracle@dave bdump]$ cd/home/oracle/

[Oracle@dave ~]$ ls

Dave DBA dead.letter Scripts sfdba Sqlnet.log

Mget Example:

Ftp> ls

Entering passive Mode (10,85,7,97,17,10)

Opening ASCII mode data connection For/bin/ls.

Drw-rw-rw-1 User Group 0 Aug 17 17:38.

Drw-rw-rw-1 User Group 0 Aug 17 17:38.

-rw-rw-rw-1 User Group 5 Aug 17:38 DBA

-rw-rw-rw-1 user group Aug 17:38 Dave

-rw-rw-rw-1 User Group 5 Aug 17:11 SFDBA

Transfer complete.

Ftp> Mget *

Mget DBA? --Each file must be confirmed, press ENTER

Entering passive Mode (10,85,7,97,17,12)

Opening BINARY mode data connection for DBA (5 Bytes).

Transfer complete.

5 bytes received in 8.1e-05 seconds (KBYTES/S)

Mget Dave?

Entering passive Mode (10,85,7,97,17,13)

Opening BINARY mode data connection for Dave (Bytes).

Transfer complete.

Bytes received in 8.3e-05 seconds (1.4e+02 kbytes/s)

Mget sfdba?

Entering passive Mode (10,85,7,97,17,14)

Opening BINARY mode data connection for SFDBA (5 Bytes).

Transfer complete.

5 bytes received in 9e-05 seconds (KBYTES/S)

Ftp>!

[Oracle@dave ~]$ ls

Dave DBA dead.letter Scripts sfdba Sqlnet.log

Description: FTP The current directory of files downloaded to the local current directory.

5. Disconnect the FTP connection

Bye command or QUIT command: Interrupts the connection to the server.

Ftp> bye

221 goodbye!

These are just a few simple examples of Linux terminal access to FTP and upload downloads. But generally these should be enough. Other features interested in their own research.

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.