I am copying a file using dd
command:
dd if=in.dat of=out.dat bs=1kb
Suppose the input file is very big and the complete copy will take say 5 min to complete.
I want to break dd
command after 1 min.
How to achieve this in shell script?
I am copying a file using dd
command:
dd if=in.dat of=out.dat bs=1kb
Suppose the input file is very big and the complete copy will take say 5 min to complete.
I want to break dd
command after 1 min.
How to achieve this in shell script?
Try this:
dd if=a.dat of=b.dat bs=1kb &
p=$!
sleep 60
kill -9 $p
Kill the most recently backgrounded process via $!
after 60 seconds
dd if=a.dat of=b.dat bs=1kb &
sleep 60 && kill $!