Linux Commands

find

Find all files from current directory and subdirectories
find . -name '*.doc' -print
Result
report.doc
somedoc.doc

Finding files by date: http://www.cyberciti.biz/faq/howto-finding-files-by-date/

du

Show total disk usage of a directory:

du -sh /tmp/somedir

Computer Forensics

The tools I use for computer forensics.

Windows

  • Recuva – Excellent at recovering data from Windows partitions and free to boot.
  • UFS Explorer – Not free, but is able to recover from linux partitions (Recuva is better for FAT/NTFS)
  • explore2fs – Access linux partitions from Windows. Free.
  • HFSExplorer – Access Mac partitions from Windows

Linux

  • Hiren’s Boot CD – Contains an impressive lineup of programs for computer forensics, but its legal status is often debated.
  • Trinity Rescue Kit – A live distro with backup programs, Midnight Commander, testdisk, shell and other good stuff. Legal!

Java Array Cast

Casting the array obtained by invoking the toArray() method on a collection yields a ClassCastException.
For example:
String[] strings = listOfStrings.toArray();
will throw the ClassCastException.
The trick is to use the overloaded version of toArray(), which takes an array as parameter. This the javadoc description of the method
toArray(T[] a)
"Returns an array containing all of the elements in this list in the correct order; the runtime type of the returned array is that of the specified array."

The solution is therefore to do this:

String[] sv = (String[])v.toArray(new String[0]);