Thursday, May 10, 2012

Check the progress of 'dd'

Even though I call 'dd' a disk destroyer, I have to use this regularly. Once, I had to copy a whole disk to another disk and was waiting for it to finish. Then, I found 'SIGUSR' signal that could be sent to a process to output some relevant information ('dd' in our case).

While 'dd' is running, open a new terminal. First let's get the PID:
# ps -A|grep dd
Then, do this:
# kill -USR1 <pid>
Now, see the terminal where 'dd' is running. You would get some details about the transfer progress. If you are really impatient, you can run this command every 20 seconds with 'watch':
watch -n 20 kill -USR1 <pid>

Convert openSUSE DVD ISO into USB image

To convert openSUSE 12.1 DVD ISO (64 Bit) to an ISO that can be dded"to a USB drive, do this:
# zypper in syslinux
# isohybrid openSUSE-12.1-DVD-x86_64.iso
Now, use SUSE Studio ImageWriter to write this ISO or dd to your usb drive.

Battery Status From Linux Command Line

When you are running a CLI or a minimal desktop environment on a laptop/netbook/notebook, it is necessary to check battery status for some reasons. 'acpi' is a system tool to provide easy human-readable battery status and information. For installing 'acpi' on Ubuntu or Debian systems, type this:
apt-get install acpi
You must be root to do that. Use 'sudo' for Ubuntu/Mint systems. Now, type 'acpi' to see battery status. I got this with a fully charged battery:
# acpi
Battery 0: Full, 100%, rate information unavailable

List all Cron Jobs From All Users

To list all cron entries from all users:
# for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
This is meant to be run as root.