LoginSignup
28
26

More than 5 years have passed since last update.

cpコマンドで大きなファイルをコピーしたときに途中経過を表示させる

Last updated at Posted at 2014-12-23

簡単なわりに地味に便利なのでよく使います。
実行中のシェルでCtrl + tを押してSIGINFOを送るだけです。
押すたびに表示されます。

$ cp very_big_file.dat ../
load: 1.95  cmd: cp 94473 uninterruptible 0.00u 0.09s
very_big_file.dat -> ../very_big_file.dat   4%
load: 1.95  cmd: cp 94473 uninterruptible 0.00u 0.60s
very_big_file.dat -> ../very_big_file.dat  27%

ただし、この機能はMac限定なので(もしかするとBSD系はいけるかも)、Linux等では使用できないです。
Linuxで同様のことをしたい場合はrsyncで--progressオプションを使うのがいいでしょう。

ちなみにSIGINFOはpingコマンドなどでも統計情報を表示するのに使えたりするので、けっこう便利です。

28
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
26