Friday, April 17, 2020

Advance RegEx - Look-Ahead / Look-Behind My Cheatsheet


Ever want to match the "Qua" in "Quality" but not in "Quantity"?

What you need is to get familiar with Look-Ahead!

For quick reference, my cheatsheet as below.



Labels: , , , , ,

Sunday, April 12, 2020

[linux] How to backup DVD to ISO file

Simple backing up my DVDs for personal use, because:
- some disc are scratched and not played well on some DVD player
- convenient to stream them to a smart TV or a media player

one single command line:

dd if=/dev/sr0 of=./image.iso bs=4m && sync


Labels: , , , , , ,

Wednesday, April 01, 2020

linux (eg. ubuntu) format USB and check health status

 usb drive doesn't have health data. 


First, find the drive device using df  or  lsblk

Eg. unmount the device sdc1

$ umount /dev/sdc1


Format usb drive to FAT32 on linux

    $ sudo mkfs.vfat -F 32 /dev/sdc1


Check disk for bad blocks by writing different byte patterns
WARNING!  Write mode is destructive. 

    $ sudo badblocks -w -s -o  myusb.log /dev/sdc
        # write-mode,  show progress, output to file 

# non-destructive 
    $ sudo badblocks -nvs > usberr.log /dev/sdc

# or through   fsck  or  mkfs
    # option:   -fcky    or      -fccky    # one 'c' read-only,  'cc'  read-write non-destructive

Labels: , , ,