It is very convenient status monitoring while copying lots number of files or large one.
Generally native linux command does not support status of copy status how much are done.
So, I found the solution through 'tar' and 'pv' utility with pipe.
tar cf - SOURCEDIR | pv | ( cd /target-dir/ ; tar xf - )
The example in the above,
> "tar cf - SOURCEDIR" : means create a tarball copy stream to STDOUT from SOURCEDIR.
> " | pv " : means retrive piped data and display progressive.
> " | ( cd /target-dir/ ; tar xf - ) : means change directory to "/target-dir/" and extract retrived data from pipe input.
You can install the pv utility for CentOS 7.
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install --disablerepo="*" --enablerepo="epel" pv
'서버 | OS > Linux - Shell Script' 카테고리의 다른 글
| Send e-mail with attachment in shell environment. (0) | 2024.02.01 |
|---|---|
| 쉘스크립트의 명령행 인자를 파싱하는 방법 (0) | 2023.10.05 |
| 쉘 환경변수에 행 단위로 텍스트 저장/불러오기. (0) | 2023.10.05 |
| 한줄로 tar + gzip 압축 진행상태 모니터링 (0) | 2023.09.09 |