macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

cpなどのコマンドの進捗をモニターするprogress

 

標準では、"cp mv dd tar cat rsync grep fgrep egrep cut sort md5sum sha1sum sha224sum sha256sum sha384sum sha512sum adb gzip gunzip bzip2 bunzip2 xz unxz lzma unlzma 7z 7za zcat bzcat lzcat split gpg" に対応している。 

 

インストール

mac10.13とcentos6に導入した。

対応OS

Linux-and-OSX

 

本体 Github

git clone https://github.com/Xfennec/progress.git
cd progress/
make

./progress -h

$ ./progress -h

progress - Coreutils Viewer

---------------------

Shows progress on file manipulations (cp, mv, dd, ...)

 

Monitored commands (default):

cp mv dd tar cat rsync grep fgrep egrep cut sort md5sum sha1sum sha224sum sha256sum sha384sum sha512sum adb gzip gunzip bzip2 bunzip2 xz unxz lzma unlzma 7z 7za zcat bzcat lzcat split gpg 

 

Usage: ./progress [-qdwmM] [-W secs] [-c command] [-p pid]

  -q --quiet                   hides all messages

  -d --debug                   shows all warning/error messages

  -w --wait                    estimate I/O throughput and ETA (slower display)

  -W --wait-delay secs         wait 'secs' seconds for I/O estimation (implies -w, default=1.0)

  -m --monitor                 loop while monitored processes are still running

  -M --monitor-continuously    like monitor but never stop (similar to watch ./progress)

  -a --additional-command cmd  add additional command to default command list

  -c --command cmd             monitor only this command name (ex: firefox)

  -p --pid id                  monitor only this process ID (ex: `pidof firefox`)

  -i --ignore-file file        do not report process if using file

  -o --open-mode {r|w}         report only files opened for read or write

  -v --version                 show program version and exit

  -h --help                    display this help and exit

/usr/local/bin/とかに移動しとく。

 

ラン

cpコマンド進捗状況を調べる。

cp input.fq output.fq &
progress

$ progress

[36984] cp input.fq

24.4% (740 MiB / 3.0 GiB)

 

%で進捗が表示される。

 

より実用的に使うなら、loopオプション-mをつけて叩く。fastqのディレクトリをカレントにコピーするのをモニターする。

cp -r raw_fastq_dir/ test_dir/ & progress -m

-mをつけると、ジョブが終わるまで進捗が表示される。

複数ジョブ、バックグラウンドでコピーしている時は、それぞれのジョブの進捗がモニターされる。

 

tar.bz2解凍の進捗をモニターする。

tar -xf SRS044742.tar.bz2 & progress -m

 

追記

何度もうつコマンドはエイリアス通すと楽なので、"P"でprogress -mを実行できるようにした。bash_profileに書き込んでソースするなら、ターミナルで以下のように打つ。

echo alias P=\'progress -m\' >> ~/.bash_profile && source ~/.bash_profile

進捗をモニタしながらコピーする。 

cp original.fq copy.fq &P

 

 

 

macだと他にもこんな方法もあるようです。gzipなどにも対応してるかは不明です。

 

*rsyncコマンドには進捗を示すオプション"-P"あり。

 

引用

GitHub - Xfennec/progress: Linux tool to show progress for cp, mv, dd, ... (formerly known as cv)

 

参考ページ