Print List of Contents of a Folder

Posted in How To, Linux, Technology, windows with tags , , , , , on August 6, 2009 by Brad

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

Posted in How To, Linux, Technology, windows with tags , , , , , , on August 1, 2009 by Brad

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.

Encryption Using GPG

Posted in How To, Linux, Technology with tags , , on July 28, 2009 by Brad

Encrypting a file with GPG so that it is password protected is fairly easy.  I will use the file file.txt as an example, but you can obviously use any file you wish.  First, open up a terminal, and cd into the directory with the file you wish to encrypt.  Then run the following:

[brad@localhost ~]$ gpg --symmetric file.txt

You will be prompted for your pass-phrase twice. Type in the same password both times and now you should see a file named file.txt.gpg (If your original filename is not file.txt then it will be whatever the original filename is + .gpg).  Remove the original file, but leave the .gpg one.  If you really want to make sure the original is gone use shred -z –remove [original_file_name].  Shred rewrites the space on the hard-drive where the file is located so that it is almost impossible to recover any information.  Note that without the –remove option shred does not remove the file, but all of the file’s contents will still be corrupted.

Decryption

To decrypt the file run the following command:

[brad@localhost ~]$ gpg --output file.txt --decrypt file.txt.gpg

You will be prompted for your password so type it in and hit enter.  The decrypted file will be named whatever you enter in after –output.

Summary

To encrypt a file do the following:

  1. Open a terminal.
  2. CD into the folder with the file you wish to encrypt.
  3. Run the command gpg –symmetric [file_name].
  4. Enter in your password twice.  A new file named [file_name].gpg should have been created.  This is the encrypted and password protected file.
  5. Run the command shred -z –remove [file_name].  DO NOT shred the encrypted file as well.

To decrypt a file perform the following:

  1. Open a terminal.
  2. CD to the location where your encrypted file is located.
  3. Run the command gpg –output [file_name] –decrypt [file_name].gpg.
  4. Enter your password.
  5. The original file should be recreated.  This file is neither password protected nor encrypted.

Convert Movies For Ipod

Posted in How To, Linux, Open Source, Technology with tags , , on July 16, 2009 by Brad

A while ago I ripped some DVDs to my computer so that I didn’t need to keep a stack of DVDs lying around.  However, the movie files are on average around 7GB in size, and that much information is not needed for my Ipod, which only has a 320 x 144 pixel screen.  The solution is just decrease the quality of the movie.  After converting the movie, the image will look fairly bad on a TV or computer screen, but it looks great on an Ipod.  The reason for decreasing the quality is that the file size also decreases and will only be around 700 MB, rather than 7GB, after the conversion.

To convert videos for your Ipod just do the following:

  1. Make sure ffmpeg is installed: sudo yum install ffmpeg
  2. Convert the video using ffmpeg: ffmpeg -s 320×144 -qmax 4 -i input_file_name.avi output_file_name.mp4

The movie will be trimmed on the edges to fit the Ipod screen with the -s 320×144 option, but if you leave this out, the movie will be shrunk to fit on the Ipod’s screen, which might make the image too small.

Remove Password From Keyring

Posted in How To, Linux, Linux Mint, Technology with tags , , , , , on July 7, 2009 by Brad

After using Fedora since 2006, I’ve decided to try out some other Linux distributions.  I briefly tried Ubuntu before I moved on to Linux Mint, and for now I am more than happy with Linux Mint.  I’ve noticed on Linux Mint, immediately after booting the gnome keyring asks for a password before Network Manager can establish a connection.  This is extremely annoying, and after a couple of months the keyring was starting to drive me crazy.

To remove the keyring password start out by doing the following.

  1. Open up your home folder
  2. View hidden files by going to View -> Show Hidden Files.
  3. Open up the folder .gnome2.
  4. Open up the folder keyrings, and delete and files in this folder.
  5. Reboot.

After rebooting enter in your password to connect to the internet, and when you are prompted to create the new keyring password click create.  Do not enter a password before moving on.  When the next window pops up, click use unsafe storage.  Now you will no longer be prompted to enter in a password for the gnome keyring.

For all those who are skimming through the instructions:

  1. Connect to the internet; if this does not happen automatically.
  2. When prompted for the keyring password, leave the entry box blank and hit create.
  3. Cick Use Unsafe Storage.

Installing Windows with Linux

Posted in How To, Linux, Open Source, Technology, windows with tags , , , , , on July 5, 2009 by Brad

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.

Connect To Windows Share with Fedora 11

Posted in Fedora, Linux, Open Source, Technology with tags , , , on July 2, 2009 by Brad

Before trying connect to a shared folder through the network you will need to install samba and allow access through your firewall.   Fedora 11 does not come with samba and also does not allow samba access through the fire wall by default; at least for me.

To install samba just run sudo yum install samba, and then after samba is installed, run sudo service smb start to turn on the smb service.  The last step to being able to connect to a shared folder is to enable samba access through the firewall.  To do this, first go to System -> Administration -> Firewall.  On the trusted services list check off samba and samba-client.

The easiest way to connect to a shared folder on the network is to go to Places -> Network, and then just click your way to where you want to go.

Better User Experience With F11

Posted in Fedora, Linux, Open Source, Technology with tags , , , , on June 13, 2009 by Brad

After my initial review of Fedora 11 Leonidas I am continuing to discover more improvements to the OS in terms of user experience.  Although modesetting still doesn’t work for me in Fedora 11 I still feel that the overall user experience is improved.

Historically my ATI Raedon Mobility X1300 has always caused me difficulty with graphics, and it still does, but in F11 I am finally able to enable desktop effects.  At first I didn’t even try to enable desktop effects and just assumed that they probably wouldn’t work since they never have before; at least not without putting a large amount of time and effort into finding the most stable driver on the internet.  Hopefully, I don’t lost desktop effects in a future update, which unfortunately has happened in the past with using Fedora.

The Control Center

The Control Center

The user switcher applet, shown above, located on the top panel (by default) also gives you the option to quickly update account information and to set system preferences.  The system preferences widget opens a control center dialog, which I would say is in some way similar to the control panel in Windows.  In the control center you can quickly manage personal preferences, appearance, start-up applications, services, hardware, system preferences, and more.

Don’t be discouraged by people claiming that Fedora 11 is no good.  If you’ve been a fan of Fedora in the past you’re bound to enjoy this release.

Fedora 11 Leonidas

Posted in Fedora, Linux, Open Source, Technology with tags , , , , , , , , on June 11, 2009 by Brad
Picture from F11 Artwork.

Picture from F11 Artwork.

Fedora 11 Leonidas was released on June 9, and contains a lot of great features such as the ext4 file system, 20 second startup, Firefox 3.5, Thunderbird 3.0, and improved modesetting.

The improved boot time is great, and I’m glad someone finally got that in there.  Although some users still might be able to improve their boot time by turning off unnecessary services. Bluetooth is enabled by default whether you have the hardware or not, and there are other services that you can disable when booting up as well.

Another great feature is the ability to browse privately in Firefox 3.5.  Now if you want to search the internet without leaving a trace on your computer you can just enable private browsing from the tools drown down menu.  When you’re done you can turn off private browsing the same way you turn it on, and you won’t have to clear private history and lose the information you want Firefox to keep track of.

One disappointment for me with Fedora 11 is that although modesetting has improved it still doesn’t work on my ATI Technologies Inc M52 [Mobility Radeon X1300].  I’m looking forward to the day modesetting finally works on my laptop.

Rpmbuild Tutorial

Posted in Fedora, How To, Linux, Open Source, Programming, Technology with tags , , , , , , on May 3, 2009 by Brad

I used to have a page on this blog for a tutorial I made for constructing rpms.  It didn’t really fit in here, and it was hard for people to read so I decided to give it it’s own site.  By doing this I was able to better organize the information on the tutorial and make it easier to read.  I think the overall reader experience is definitely improved by moving the tutorial, and hopefully the readers agree once they figure out that I moved it.

I’ve also moved some old packages I put together that used to be available on my download page.  The entire page has moved and is basically the same as it was before.  The downloads went with the tutorial since I use the downloads as examples.  If you’re interested here is the link to the tutorial.  Before I changed my blog url this tutorial was very popular.  I suspect people will pick up on it again once google crawls it.