dd with progress bar

Friday, 3. February 2012

 

if you need a progress indicator while using dd you will find this interesting.

sudo dd if=/dev/zero bs=2048 | pv -s 8G | sudo dd bs=2048 of=/dev/null

just give “pv” the size of the input device (image) and pipe dd through.

 

Get device name of the newest usb-thumb-drive in the system

Thursday, 2. February 2012

this post is just a note to myself (like many others on this blog)

ls -t /dev/sd* | head -1 | /bin/sed -e 's/^\/dev\/*//' |cut -c 1-3
 

i had to figure out a way to determine the name of the usb-thumb-drive i JUST connected within a script – well.. it works but im open for suggestions 🙂

first i list all devices that begin with “sd” sorted by creation time/date 

then i filter the newest device and cut off  the string “/dev/”

at last i cut the first 3 letters of the string because that’s all i need (i do not need to know the partition number of the device)