얼마전에 리눅스 사용중에 파일 다운로드가 필요하여
wget 명령어를 알게 되었습니다.
■ wget
인터넷을 통해 파일이나 디렉터리를 다운로드 할수 있는 기능입니다.
그런데 wget 명령어를 실행해보니 명령어를 찾을수 없다고 하네요.
[root@localhost ~]# wget -bash: wget: command not found [root@localhost ~]# man wget No manual entry for wget |
CentOS7 minimal (최소) 버전이라 설치가 안되어 있어요.
yum 으로 일단 설치부터 합니다.
[root@localhost ~]# yum install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.navercorp.com * extras: mirror.navercorp.com * updates: mirror.navercorp.com base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: wget x86_64 1.14-18.el7_6.1 base 547 k Transaction Summary ============================================================================= Install 1 Package Total download size: 547 k Installed size: 2.0 M Is this ok [y/d/N]: y Downloading packages: wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-18.el7_6.1.x86_64 1/1 Verifying : wget-1.14-18.el7_6.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-18.el7_6.1 Complete! |
● 설치 확인
♣ wget 또는 version 명령어 간단히 확인하기 [root@localhost ~]# wget wget: missing URL Usage: wget [OPTION]... [URL]... Try `wget --help' for more options. [root@localhost ~]# wget --version GNU Wget 1.14 built on linux-gnu. +digest +https +ipv6 +iri +large-file +nls +ntlm +opie +ssl/openssl Wgetrc: /etc/wgetrc (system) Locale: /usr/share/locale Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc" -DLOCALEDIR="/usr/share/locale" -I. -I../lib -I../lib -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic Link: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -lssl -lcrypto /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so -ldl -lz -lz -lidn -luuid -lpcre ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Originally written by Hrvoje Niksic <hniksic@xemacs.org>. Please send bug reports and questions to <bug-wget@gnu.org>. |
● wget 사용법
다양한 옵션들 중에서 주로 사용하는 것들을 정리합니다.
♣ 기본 사용법 ▶ wget URL [tmach@localhost test]$ wget https://go.dev/dl/go1.16.10.linux-amd64.tar.gz --2021-11-29 13:16:01-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.38.21, 216.239.32.21, 216.239.36.21, ... Connecting to go.dev (go.dev)|216.239.38.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:16:02-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 142.251.42.142, 2404:6800:4004:81d::200e Connecting to dl.google.com (dl.google.com)|142.251.42.142|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 129066413 (123M) [application/x-gzip] Saving to: ‘go1.16.10.linux-amd64.tar.gz’ 100%[================================================>] 129,066,413 10.4MB/s in 12s 2021-11-29 13:16:15 (9.91 MB/s) - ‘go1.16.10.linux-amd64.tar.gz’ saved [129066413/129066413] [tmach@localhost test]$ ll total 126044 drwxrwxr-x. 2 tmach tmach 6 Nov 29 13:15 down -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go1.16.10.linux-amd64.tar.gz ♣ 이어받기 ▶ wget -c URL [tmach@localhost test]$ wget https://go.dev/dl/go1.16.10.linux-amd64.tar.gz --2021-11-29 13:20:24-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.34.21, 216.239.36.21, 216.239.38.21, ... Connecting to go.dev (go.dev)|216.239.34.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:20:25-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 172.217.31.174, 2404:6800:4004:821::200e Connecting to dl.google.com (dl.google.com)|172.217.31.174|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 129066413 (123M) [application/x-gzip] Saving to: ‘go1.16.10.linux-amd64.tar.gz’ 16% [===============> ] 21,225,312 8.93MB/s 16% 다운로드 도중에 중지되었을때 -c 옵션으로 이어받기 [tmach@localhost test]$ wget -c https://go.dev/dl/go1.16.10.linux-amd64.tar.gz --2021-11-29 13:20:33-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.34.21, 216.239.36.21, 216.239.38.21, ... Connecting to go.dev (go.dev)|216.239.34.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:20:33-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 172.217.175.46, 2404:6800:4004:808::200e Connecting to dl.google.com (dl.google.com)|172.217.175.46|:443... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 129066413 (123M), 105670237 (101M) remaining [application/x-gzip] Saving to: ‘go1.16.10.linux-amd64.tar.gz’ 100%[+++++++++++++++++================================>] 129,066,413 10.2MB/s in 10s 2021-11-29 13:20:44 (9.94 MB/s) - ‘go1.16.10.linux-amd64.tar.gz’ saved [129066413/129066413] +++ 기호가 이어받은 부분입니다. ♣ 백그라운드 수행 ▶ wget -b URL [tmach@localhost test]$ wget -b https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Continuing in background, pid 9788. Output will be written to ‘wget-log’. 화면에 아무 표시가 없어서 다운로드 되는데 ll 명령어로 확인해봤어요. 파일 사이즈가 점점 늘어나는걸 보니 다운로드 잘 하고 있네요. [tmach@localhost test]$ ll -rw-rw-r--. 1 tmach tmach 46841504 Nov 29 13:26 go1.16.10.linux-amd64.tar.gz [tmach@localhost test]$ ll -rw-rw-r--. 1 tmach tmach 62848560 Nov 29 13:26 go1.16.10.linux-amd64.tar.gz [tmach@localhost test]$ ll -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go1.16.10.linux-amd64.tar.gz -rw-rw-r--. 1 tmach tmach 193076 Nov 29 13:26 wget-log wget-log 파일이 생기고 다운로드 진행과정을 기록해주네요. ♣ 파일 다른이름으로 저장 ▶ wget -O 파일명 URL [tmach@localhost test]$ wget -O go_lang https://go.dev/dl/go1.16.10.linux-amd64.tar.gz --2021-11-29 13:30:57-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.32.21, 216.239.34.21, 216.239.36.21, ... Connecting to go.dev (go.dev)|216.239.32.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:30:58-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 216.58.220.142, 2404:6800:4004:820::200e Connecting to dl.google.com (dl.google.com)|216.58.220.142|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 129066413 (123M) [application/x-gzip] Saving to: ‘go_lang’ 100%[===============================================>] 129,066,413 9.85MB/s in 12s 2021-11-29 13:31:10 (9.95 MB/s) - ‘go_lang’ saved [129066413/129066413] [tmach@localhost test]$ ll total 126044 drwxrwxr-x. 2 tmach tmach 6 Nov 29 13:15 down -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go_lang ♣ 진행 과정 미출력 ▶ wget -q URL [tmach@localhost test]$ wget -q https://go.dev/dl/go1.16.10.linux-amd64.tar.gz [tmach@localhost test]$ [tmach@localhost test]$ ll -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go1.16.10.linux-amd64.tar.gz 아무 표시없이 끝나서 ll 명령어로 확인했습니다. ♣ 진행 과정 로그 생성 ▶ wget -o 로그 URL [tmach@localhost test]$ wget -o down.log https://go.dev/dl/go1.16.10.linux-amd64.tar.gz [tmach@localhost test]$ ll -rw-rw-r--. 1 tmach tmach 193068 Nov 29 13:33 down.log -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go1.16.10.linux-amd64.tar.gz down.log 파일을 지정했어요. 내요을 보니 다운로드 진행과정이 그대로 표시되어 있어요. [tmach@localhost test]$ cat down.log --2021-11-29 13:33:20-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.32.21, 216.239.36.21, 216.239.34.21, ... Connecting to go.dev (go.dev)|216.239.32.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:33:20-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 216.58.197.206, 2404:6800:4004:824::200e Connecting to dl.google.com (dl.google.com)|216.58.197.206|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 129066413 (123M) [application/x-gzip] Saving to: ‘go1.16.10.linux-amd64.tar.gz’ 0K .......... .......... .......... .......... .......... 0% 765K 2m45s 50K .......... .......... .......... .......... .......... 0% 1.25M 2m12s ..............................생략.............................. ♣ 원하는 디렉터리에 다운로드 ▶ wget -P 디렉터리 URL [tmach@localhost test]$ wget -P down https://go.dev/dl/go1.16.10.linux-amd64.tar.gz --2021-11-29 13:36:02-- https://go.dev/dl/go1.16.10.linux-amd64.tar.gz Resolving go.dev (go.dev)... 216.239.34.21, 216.239.36.21, 216.239.38.21, ... Connecting to go.dev (go.dev)|216.239.34.21|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz [following] --2021-11-29 13:36:02-- https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 142.251.42.206, 2404:6800:4004:818::200e Connecting to dl.google.com (dl.google.com)|142.251.42.206|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 129066413 (123M) [application/x-gzip] Saving to: ‘down/go1.16.10.linux-amd64.tar.gz’ 100%[=============================================>] 129,066,413 10.3MB/s in 12s 2021-11-29 13:36:15 (10.0 MB/s) - ‘down/go1.16.10.linux-amd64.tar.gz’ saved [129066413/129066413] down 디렉터리를 만들고 down 안에 다운로도 되는지 확인했어요. [tmach@localhost test]$ ll drwxrwxr-x. 2 tmach tmach 42 Nov 29 13:36 down [tmach@localhost test]$ cd down [tmach@localhost down]$ ll -rw-rw-r--. 1 tmach tmach 129066413 Nov 4 11:22 go1.16.10.linux-amd64.tar.gz |
감사합니다.
반응형
'IT > LINUX' 카테고리의 다른 글
리눅스 CentOS solidity 컴파일러 solc 설치하기 . 샘플 컴파일 (1) | 2022.10.04 |
---|---|
리눅스 tree 명령어 설치와 사용법 (0) | 2022.10.03 |
CentOS7 minimal 설치 후속 작업들 (0) | 2022.10.01 |
리눅스 시스템 종료 재부팅 명령어 (0) | 2021.11.26 |
리눅스 쉘 프롬프트(prompt) 호스트명 바꾸기 (0) | 2021.11.08 |
댓글