Archive for the 'windows' Category

Print List of Contents of a Folder

Sometimes it can be useful to print out a list of a folder’s contents.  The best way to do this on windows, in my opinion, is to use the commandline.  To open the prompt, hit Windows + R, and then type cmd into the prompt before hitting enter.  Afterwards, a screen should pop up that looks similar to this:

Cmd Prompt

Cmd Prompt

The basics you need to know are the dir, chdir, and help commands.  The  dir command outputs your current location and also the contents of the folder your in.  The chdir command lets you change your folder location.  However, to switch to another drive just type the drive letter followed by a colon.  For instance, to switch to the C drive type C:, and then hit enter.  For help with more options for dir and chdir just type help dir or help chdir.

Print Folder Contents Using Windows

  1. Hit the keys Windows + R.
  2. Type cmd into the run prompt and then hit enter.
  3. Use the chdir command to get the folder you wish.
  4. Run the command dir /b > list.txt to get a list of all the contents in the folder.
  5. Print the file list.txt.

Print Folder Contents Using Linux

  1. Open up a terminal.
  2. Use cd to get to the folder you want the list of contents from.
  3. Run the command ls -a > list.txt.
  4. Print the file list.txt.

Data Erasure and Recovery

When files/folders are deleted the information is not actually removed from your computer.  The file still exists, but the space that it exists on becomes free to be written over.  However, there are tools that you can use to erase this information completely so that it cannot be recovered. From what I’ve read, these tools actually just “make it harder” to recover information, and the best way to ensure that information is completely destroyed is to fry the hard drive by degaussing it or dissolving it in acid.

Normally I use a tool called shred to remove files, but it cannot remove directories.  There is another tool, called scrub, which can do this.  Shred and scrub work basically in the same way.  They just rewrite the disk space, where the file/folder is stored, over and over again to corrupt the information stored there.

Another tool you can use is called DBAN, which is a self contained boot disk that you can use to erase an entire hard drive.  It works basically the same way as shred and scrub by repeatdly rewritting then entire hard drive with random numbers.  The benefit of DBAN is that it can be booted from a CD, DVD, or USB and can erase the entire hard drive.  The homepage for DBAN is here.

To use shred:

  1. Open a terminal.
  2. CD to where the file is stored.
  3. Run the command shred -vz –remove [file_name].

The -v option is verbose so if you don’t want to see all the information shred will spit back at you the leave this option out.  The -z option rewrites the space on the final time with all zeros, and the  –remove option removes the file after it’s been rewritten.

Shred can be used recursively to erase a bunch of files in a folder by running find [directory] -type f | xargs shred -zu.

Recovering Lost Information

The best way to prevent loss of data is to backup your files.  I do this every once in a while on a separate hard-drive to also protect myself from hard-drive crashes.  In other cases, if just the operating system has crashed you can grab your files using a live-cd or live-usb.  I always keep a Fedora live-cd laying around, but there are others, such as Knoppix, that you can use as well.

However,  if you deleted a file/folder and didn’t repeatedly rewrite the disk space it was on, then you might be able to recover it using a program called testdisk, which I found here.  It can be used to scan drives to recover information, and it works on both Windows and Linux, although I have not tried it with Windows.

Here is the tutorial I used when learning how to use testdisk.

Installing Windows with Linux

For a few years now I have been running Fedora on my entire hard drive, and after a while I decided to reinstall Windows for compatibility with certain programs that won’t run on Linux.  There are a few complications, however, when getting Windows to install after it has been completely removed.

Windows cannot read the hard drive if it has been completely erased, and furthermore, if the hard drive has Linux on it, and is formatted as ext3 or ext4, a Windows install CD will not work.  During the installation process either the screen will go black or an error will notify that Windows cannot be installed.  At least this has been my experience with multiple installation CDs.

The solution is to reformat the hard-drive as fat32, or ntfs, using GParted.  A live version of GParted can be found here.  Just boot the CD, or live-USB, and use GParted to repartition the entire drive as fat32.  Then you should be able to install windows.  Afterwards, you can use GParted to shrink the Windows partition down if you want to install Linux on a separate partition.  Make sure you install Windows first because it will use the entire hard drive when it installs.

In case something won’t install right, I would also recommend having a Live CD for your favorite Linux distribution .  Otherwise, you might be left without an OS.

Summary:

  1. Back up your files.
  2. Create a live-CD for the Linux distribution you use if you don’t already have one.
  3. Install GParted Live CD from http://gparted.sourceforge.net/livecd.php.
  4. Use the live-CD to reformat the hard drive as fat32 or ntfs.
  5. Install windows.
  6. Resize hard-drive using Gparted.
  7. Install Linux.

Just a side note, GRUB can boot windows, but the windows boot loader cannot boot Linux.  Also when I did this,  I reformatted the hard drive as fat32.  I didn’t try doing this with ntfs, but I’m fairly sure it will work.  The trick is to get windows to recognize the hard drive.



Follow

Get every new post delivered to your Inbox.