본문 바로가기
OS/Linux

리눅스 기초 30강 시리즈 - 19강 ftp client 사용법

by HJ0216 2023. 2. 3.

이 글은 양주종의 코딩스쿨 리눅스(Linux) 기초 강좌 30강 모음 수강하며 정리한 글입니다.

 

19강 ftp client 사용법

(일반 사용자 id: j, pw: j)

(관리자 id: root, pw: r)

 

 

FTP: File Transfer Protocol

: TCP/IP 프로토콜을 가지고 서버와 클라이언트 사이의 파일 전송을 하기 위한 프로토콜

 

FTP 사용을 위한 FTP 설치 확인

[j@hj0216 ~]$ rpm -qa | grep ftp
ftp-0.17-67.el7.x86_64

 

FTP 용어 확인

1. FTP 실행 및 명령어 리스트 반환

[j@hj0216 ~/down]$ ftp
ftp> ?
Commands may be abbreviated.  Commands are:

!               debug           mdir            sendport        site
$               dir             mget            put             size
account         disconnect      mkdir           pwd             status
append          exit            mls             quit            struct
ascii           form            mode            quote           system
bell            get             modtime         recv            sunique
binary          glob            mput            reget           tenex
bye             hash            newer           rstatus         tick
case            help            nmap            rhelp           trace
cd              idle            nlist           rename          type
cdup            image           ntrans          reset           user
chmod           lcd             open            restart         umask
close           ls              prompt          rmdir           verbose
cr              macdef          passive         runique         ?
delete          mdelete         proxy           send

 

2. 명령어 조회

ftp> ? mget
mget            get multiple files
ftp> ? put
put             send one file
ftp> ? mput
mput            send multiple files
ftp> ? ls
ls              list contents of remote directory
ftp> ? open
open            connect to remote ftp

 

Web Browser: ftp.kaist.ac.kr/apache/httpd

 

Linux를 통한 ftp - file download

1. 파일 위치에 따른 dir 경로 이동(기존 경로이동과 유사)

ftp> cd apache
250-Please try to use a mirror if at all possible.  There is a complete list
250-of mirrors available at <http://www.apache.org/mirrors/>, and a script
250-which will attempt to find those close to you at
250-<http://www.apache.org/dyn/closer.cgi>.
250 Directory successfully changed.
ftp> cd httpd
250 Directory successfully changed.
ftp> pwd
257 "/apache/httpd" is the current directory

 

2. 해당 dir 내 list 확인

ftp> ls
227 Entering Passive Mode (103,22,220,133,111,213)
150 Here comes the directory listing.
-rw-rw-r--    1 1000     1000         3883 Jan 17 13:32 Announcement2.4.html
-rw-rw-r--    1 1000     1000         2518 Jan 17 13:32 Announcement2.4.txt
-rw-rw-r--    1 1000     1000       341911 Jan 17 16:15 CHANGES_2.4
-rw-rw-r--    1 1000     1000         7386 Jun 08  2022 CHANGES_2.4.54
-rw-rw-r--    1 1000     1000         7060 Jan 17 16:15 CHANGES_2.4.55
-rw-rw-r--    1 1000     1000            0 Jan 17 16:15 CURRENT-IS-2.4.55
-rw-rw-r--    1 1000     1000          682 Oct 03  2009 HEADER.html
-rw-rw-r--    1 1000     1000         3031 Oct 03  2009 README.html
drwxr-xr-x    4 1000     1000           69 Jun 17  2022 binaries
drwxr-xr-x    2 1000     1000           65 Jun 17  2022 docs
-rw-rw-r--    1 1000     1000      7434530 Jun 08  2022 httpd-2.4.54.tar.bz2
-rw-rw-r--    1 1000     1000      9743277 Jun 08  2022 httpd-2.4.54.tar.gz
-rw-rw-r--    1 1000     1000      7456187 Jan 17 13:32 httpd-2.4.55.tar.bz2
-rw-rw-r--    1 1000     1000      9758888 Jan 17 13:32 httpd-2.4.55.tar.gz
-rw-rw-r--    1 1000     1000        19006 Dec 21  2016 httpd_logo_wide_new.pn
drwxr-xr-x    2 1000     1000          108 Aug 25 13:10 libapreq
drwxr-xr-x    3 1000     1000          193 Jun 17  2022 mod_fcgid
drwxr-xr-x    2 1000     1000          124 Jun 17  2022 mod_ftp
drwxr-xr-x    3 1000     1000           83 Jun 17  2022 patches
226 Directory send OK.

 

3. FTP를 통한 file download

ftp> get httpd-2.4.55.tar.gz
local: httpd-2.4.55.tar.gz remote: httpd-2.4.55.tar.gz
227 Entering Passive Mode (103,22,220,133,231,218)
150 Opening BINARY mode data connection for httpd-2.4.55.tar.gz (9758888 bytes.
226 Transfer complete.
9758888 bytes received in 1.31 secs (7460.72 Kbytes/sec)

 

4. FTP 종료

ftp> by
221 Goodbye.

 

5. Download받은 파일 List 확인

[j@hj0216 ~/down]$ ls
httpd-2.4.55.tar.gz