A chronological documentation test project, nothing serious, really!

10 Sep 2010 Randomize filenames

This is a simple bash script to create random filenames of all jpg-files (*.jpg) in a folder using the linux commands mv, sha1sum and cut.

# Randomize filenames

for fname in *.jpg;
        mv "$fname" $(echo "$fname" | \
                sha1sum | \
                cut -f1 -d ' ' | \
                cut -b 1-5).jpg

The jpg-files can have names like


Tags: , , ,

Posted by

10 Sep 2010 Show mounted partitions with a nice layout

This command shows the result of a mount command in a nice table layout

# mount | column -t


/dev/sda1         on  /                                            type  ext4                   (rw,errors=remount-ro)
/dev/sda2         on  /home                                        type  ext4                   (rw)

Tags: ,

Posted by

09 Sep 2010 Compare a remote file with a local file using ssh and diff

# ssh cat /path/to/remotefile | diff /path/to/localfile -

Tags: ,

Posted by

05 Sep 2010 Datarecovery using Ubuntu Linux

This post describes my workflow in recovering data from defective harddrives. These harddrives are usually not readable in Windows and in most cases not even readable or mountable in linux as well. One of the great things with linux is all the tools that are available, just do a Google search and you find forum threads with suggestions on tools and ways to fix things.

Software used

  • gddrescue
  • – create a disk image of the corrupted disk or partition:

    # ddrescue -r3 /dev/sda rescue.img rescue.log -force

    This command copies from data from harddisk /dev/sda to imagefile rescue.img and writes a log to the rescue.log file. You could have switched rescue.img with another harddisk like /dev/sdb if you would like to duplicate it. ddrescue will try to read data up to three times before it gives up and continues with other data. -force is a selfexplained switch that tells ddrescue to perform this operation despite any warnings.

  • testdisk, and
  • mmls
  • – from The Sleuth Kit can show you the partitions found within an image

A good page about datarecovery

Tags: , , , ,

Posted by