Copy files while showing progress
The standard cp tool from GNU coreutils just copies files silently. This can be a little unnerving when copying large chunks of data. You're left to wonder whether it's actually doing something or just got stuck.
How to copy files and directories in terminal while displaying some kind of progress information?
Use `rsync` instead: ```console $ rsync --progress filename /target/ filename 1,042,841,600 17% 330.84MB/s …
3mo ago
If you don't mind installing an additional tool, `progress` will do exactly what you want. > progress aims to detect …
1mo ago
Pipe Viewer or `pv` is a program for displaying the throughput of any pipe. It can be used to monitor all sorts of trans …
1mo ago
Why not simply use `ls -l` on the target file? Or `ls -lt | head` on the directory? The `-lt` option makes `ls` to sh …
3mo ago
As long as you are working interactively, Midnight Commander is installed by default on every distribution that I know o …
3mo ago
5 answers
If you don't mind installing an additional tool, progress will do exactly what you want.
progress aims to detect any running command performing significant file I/O. Commonly supported commands include: cp, mv, dd, tar, gzip, gunzip, cat (when copying), rsync (local operations), dpkg, rpm, and various archivers like zip, unzip, xz, bzip2, bunzip2. Its effectiveness depends on how the command performs its I/O and if it keeps file descriptors open predictably.
Example:
$ cp filename /target/ | progress -m
[286427] cp filename
13.2% (753.5 MiB / 5.6 GiB) 166.1 MiB/s remaining 0:00:29
Note: This will only show the individual progress per file copied, no overall progress if multiple files are copied.
Pipe Viewer or pv is a program for displaying the throughput of any pipe. It can be used to monitor all sorts of transfers, but for a simple copy you don't even need to pipe any other commands. Just select the file as the input and direct to your destination:
$ pv source.file --output destination.file
2,53MiB 0:00:00 [ 536MiB/s] [=======================================>] 100%
0 comment threads
Why not simply use ls -l on the target file? Or ls -lt | head on the directory?
The -lt option makes ls to show long description, including size and timestamp, while sorting by timestamp.
So you can see, from the timestamp, if the command has done recent changes, and from the size, what is the progress.
Maybe you have to send the cp command to the background (preferably by adding an "&" at the end of it, or to open another shell.
If something looks strange, you can uses top or ps aguwx | grep <yourfilename> to see if the process is still actve.
0 comment threads
As long as you are working interactively, Midnight Commander is installed by default on every distribution that I know of. It shows elaborate details about the progress of copy and move operations.

2 comment threads