跳至主要内容

linux下显示dd命令的进度

linux下显示dd命令的进度:
dd if=/dev/zero of=/tmp/zero.img bs=10M count=100000
想要查看上面的dd命令的执行进度,可以使用下面几种方法:
比如:每5秒输出dd的进度
方法一:
watch -n 5 pkill -USR1 ^dd$
方法二:
watch -n 5 killall -USR1 dd
方法三:
while killall -USR1 dd; do sleep 5; done
方法四:
while (ps auxww |grep " dd " |grep -v grep |awk '{print $2}' |while read pid; do kill -USR1 $pid; done) ; do sleep 5; done
上述四种方法中使用三个命令:pkill、killall、kill向dd命令发送SIGUSR1信息,dd命令进程接收到信号之后就打印出自己当前的进度。

评论

此博客中的热门博文

android hide actionbar

public class MainActivity extends Activity { ActionBar actionBar; //声明ActionBar @Override protected void onCreate( Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView( R .layout.activity_main); actionBar = getSupportActionBar(); //得 到ActionBar actionBar.hide(); //隐藏ActionBar } }

go url encoding

func  QueryUnescape func QueryUnescape (s string ) ( string , error ) QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits. func  QueryUnescape func QueryUnescape (s string ) ( string , error ) QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits.