msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

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.

#!/bin/bash
# Randomize filenames

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

The jpg-files can have names like

08df4.jpg  
1e788.jpg  
315e6.jpg  
41e19.jpg  
5f7d0.jpg  
7471e.jpg

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

Result

/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 user@example.com 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, http://www.cgsecurity.org/wiki/TestDisk:_undelete_file_for_NTFS and https://help.ubuntu.com/community/DataRecovery
  • mmls
  • – from The Sleuth Kit can show you the partitions found within an image

A good page about datarecovery https://help.ubuntu.com/community/DataRecovery

Tags: , , , ,

Posted by