SIGINFO is awesome

Published on

TIL - SIGINFO is awesome

Today I learnt something really awesome. If you use a Unix based operating system, then you will be able to send any process a signal. This might be either Ctrl+C or SIGINT to interrupt that process. Or you can send SIGINFO to report the progress of it’s operation. Why this is awesome? Did you ever copy a huge amount of data and cp didn’t tell you how much has data has been copied so far? SIGINT to the rescue.

1irichter@irichter-MacBookPro:~/Documents/Virtual Machines » cp -a dev-setup.vmwarevm dev-setup-2.vmwarevm
2
3load: 2.02  cmd: cp 49102 uninterruptible 0.05u 2.28s
4dev-setup.vmwarevm/dev-setup-61da15a0.vmem -> dev-setup-2.vmwarevm/dev-setup-61da15a0.vmem  32%
5
6load: 2.02  cmd: cp 49102 uninterruptible 0.06u 4.11s
7dev-setup.vmwarevm/dev-setup-61da15a0.vmem -> dev-setup-2.vmwarevm/dev-setup-61da15a0.vmem  74%

I send Ctrl+T two times to the cp process. In one case 32% of the data has been copied. In the other case 74%.

This will help especially with programs that don’t have an option to report progress.

#howto   #Programming   #shell   #cli  

comments powered by Disqus