FTP Upload download record

Source: Internet
Author: User
Tags ftp client filezilla shebang

1. Prepare the FTP environment
Download the latest FTP client:Httpsfilezilla-project.org/ftp/001.png, choose the following version of linux, such as002.png: download below window10, use wgethttpsourceforge.net/projects/filezilla/files/filezilla_client/3.26.1/filezilla_3.26The. 1_i586-linux-gnu.tar.bz2 is downloaded from the Linux command line. decompression, TAR-XVF Filezilla_3.26.1_I586-LINUX-GNU.TAR.BZ2 installation Ftp:yum install vsftpd-y boot: service VSFTPD start attempt ftp command, error [root@hch_test_dbm1_121_62 bin]# ftp-Bash:Ftp:commandNot Found[root@hch_test_dbm1_121_62 bin]#直接下载ftp安装包 wgethttpmirror.centos.org/centos/6/os/x86_64/packages/ftp-0.17-54.el6.x86_64.rpm then install [root@hch_test_dbm1_121_62 soft]# RPM-IVH ftp-0.17-54.el6.x86_64.rpm Preparing ...########################################### [100%]1:ftp########################################## # [100%][root @hch_test_dbm1_121_62 soft]# installation Error Libc.so.6 is needed by ftp- 0.17-35.el5.i386 to install RPM–UVH //mirror.centos.org/centos/6/os/x86_64/Packages/ Glibc-2.12-1.132.el6.x86_64.rpm Try ftp operation [root @hch_test_dbm1_121_62 soft]# ftpftp>      
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21st
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21st
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27



2, Automatic Login Download
#!/bin/bashftp -n<<!open 120.132.27.91 10000user downdata RakudespuH3bAk+ruybinarycd uplcd /home/mysql/binlogspromptmget mysql-bin*closebye!
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12



3, Automatic Login Upload
#本地的/home/databackup to ftp服务器上的/home/data#####!/bin/bashftp -n<<!open 192.168.1.171user guest 123456binaryhashcd /home/datalcd /home/databackuppromptmput *closebye!
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14



4, the techniques involved
#!/bin/bash#提取文件名, Remove the Suffix. File_name="text.gif" name=${file_name%.*}echo File name Is:$name output: file name is:test the matching operation from right to Left: example of% and percent of operator [[email protected]_test_dbm1_121_62 load_binlog]# Filename=mysql-bin.000110.zip[[email protected]_test_dbm1_121_62 load_binlog]# Name=${filename%.*}[[email protected]_test_dbm1_121_62 load_binlog]# echo $namemysql-bin.000110[[email protected]_test_dbm1_121_62 load_binlog]# See the output is no. zip filename mysql-bin.000110------------------------------------------------some scripts to be processed according to the file name, sometimes you need to keep the file name to discard the suffix, sometimes need to file suffix do not file name, This kind of extract file part of the operation using the Shell's built-in functionality can be Achieved. There are several operators that need to be used:%, percent,#、##。 Right-to-left matching: Example of% and percent% operators#!/bin/bash#提取文件名, Remove the Suffix. File_name="text.gif" name=${file_name%.*}echo File name Is:$name output: file name Is:test# ${var%.*} Meaning: removes the wildcard character on the right side of the match from the $var, matching the wildcard character from right to Left. Now assign the variable name to name=text.gif, then the wildcard character will match from right to left to. gif, all delete the matching result from the $VAR.#% belongs to the Non-greedy operator, and he is the shortest result from left to right; File_name="text.gif.bak.2012" name=${file_name%.*}name2=${file_name%%.*}echo File name Is:$nameecho File name Is:$name 2 output: file name Is:test.gif.bak//use%file name Is:test//use percent of percent operator for percent usage. * from right to left greedy match to. Gif.bak.2012 match from left to Right:# and # # operator examples#!/bin/bash#提取后缀, Delete the file Name. File_name="text.gif" suffix=${file_name#*.}echo suffix is:$suffix output results: suffix is:gif# ${var#*.} Meaning: removes the string that matches the wildcard character on the right side of the # from the $VAR, and the wildcard is left-to-right to Match.# as with%, # There are greedy operators # #. File_name="text.gif.bak.2012.txt" suffix=${file_name#*.} Suffix2=${file_name##*.}echo suffix is:$suffixecho suffix is:$suffix 2 output results: suffix Is:text.gif.bak.2012//use #suffix2 is:txt//use # #操作符 # # Use *. from left to right greedy match to text.gif.bak.2012 example 2, define variable url="WWW.1987.N Ame "echo ${url%.*} #移除. * matches the rightmost Content. Www. 1987Echo ${url%%.*} #将从右边开始一直匹配到最左边的 *. remove, greedy Operator. wwwecho ${url#*.} #移除 *. All matches the leftmost content. 1987.nameEcho ${url##*.} #将从左边开始一直匹配到最右边的 *. remove, greedy Operator. Name                   

FTP Upload download record

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.