Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
Why doesn't cp have a progress bar like wget?

Lately I have been dealing with rather large files in Linux. I often use commands like sed, cut, sort, uniq, awk, and perl to slice, dice, and view the contents of these large files. I am usually unsure whether an operation like this will complete in seconds, hours, days, or "never".

Other platforms like Windows, Mac OS X, and the Internet, are quick to show the user a progress bar indicator to show how fast the work or upload is progressing, and maybe even tell how much time is left.

With most of the above examples, it is possible guesstimate the current progress by actively thinking about how exactly the command is modifying the file, and then checking the current size of the output on disk. Or maybe by watching the rate of change of the file size on disk. But with some commands like sort -d -u big_file > output_file it seems that there is no possible way to know whether the operation will be completed in one minute or one year.

Is this missing feature intentional? Is there a linux-way to do this? Is this need usually just obviated by smaller sized files?

Would a real haxor just intuitively know the progress of these operations by merely scanning values directly out of the .pid file?

share|improve this question

marked as duplicate by jasonwryan, Renan, Michael Mrozek Oct 8 '12 at 22:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

2 Answers 2

up vote 2 down vote accepted

It's against the UNIX ethos, yes. As a rule, Unix commands return no output on success; they only give output on error. This is good for automation; a script can treat any output from a command as an error report and log it or mail it to the sysadmin. This is how the cron daemon works.

Please remember that Unix is designed to be automated, not to have the sysadmin hovering over the console, watching everything that happens.

That said, many utilities have an equivalent of the -verbose (or -v or --verbose) flag, to give more output. rsync has the --progress flag, for instance. Still other tools will detect whether they are being used in an interactive session or a script and tailor output accordingly. Wget provides one kind of progress indicator for interactive sessions, another for scripts but can be silenced entirely.

There are also several utilities (e.g. bar, dbar, pv) which are designed to be used as pipes within data transfers and indicate progress. Add them in at need.

share|improve this answer
add comment

pv is your friend. Insert it wherever you want to see the progress.

Like

pv big_file | sort ...
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.