The word count command (wc) is a utility that will count the bytes, characters, words, or lines of standard input, a file, or several files.

Without passing any options, wc returns line, word and byte counts for its input.  Say we have a file called foo.txt with the following contents:

foo
foo

If we run wc against this file we will get:

$ wc foo.txt
2 2 8 foo.txt

Notice, however that the byte count is two bytes too many for what you’d expect. A quick glance at the content of the file tells us that there are only 6 characters, and therefore only 6 bytes in the file. Even if we try to run wc with the character specific option “-m”, we get the same:

$ wc -m foo.txt
8 foo.txt

The same thing happens whether we use the “-c” option for bytes or the “-m” option for characters. This is because of the unseen newline character at the end of each line. Even if we echo a line of text to wc, we get the same effect.

$ echo foobar | wc -m
7

If you want a true count of the characters, you have to take the newlines into account. We can remove the newlines from echo easily enough with tr:

$ echo foobar | tr -d '\n' | wc -m
6

Actually, we can do it even easier, by using echo‘s “-n” option which removes the newline characters from standard output:

$ echo -n foobar | wc -m
6

But if you want to pass a file to wc and get an output that doesn’t take the newlines into account, you’re probably stuck using tr

$ cat foo.txt | tr -d '\n' | wc -m
6

From linux-mag.com:

The major derivatives of Ubuntu are well known, but what about the others? Just because they aren’t as popular doesn’t mean they don’t have something to offer! We introduce five of the least known, yet simply outstanding distributions.

The article gives a nice overview of

  • DEFT – the Digital Evidence & Forensic Toolkit: a distro running LXDE and targeting foresnic work with packages like Sleuthkits’s Autopsy, ophcrack and ClamAV
  • Element – a home theater PC distro targeted at HDTVs
  • Jolicloud – you guessed it: a cloud-based distro for netbook users
  • moonOS – an elegantly, artsy distro using the little-known Enlightenment window manager.  it looks to have even more style than Fluxbuntu did back when it was an actively developed distro.
  • wattOS – a lightweight, power-efficient distro (think DSL, Puppy and Tiny Core) recommended for recycled PCs

Checking the SMART information on your hard drive

It looks like Ubuntu 9.10 comes with some handy tools for checking the health of your hard drive.

  • Palimpsest – GUI tool
  • devkit-disks – CLI tool

Check out this blog on linux.com for screenshots of Palimpsest.  Although, beware, launchpad currently shows a bug related to the error that shows up in the screenshots.

If you happen to get what you think is a false positive for SMART value 5 “Reallocated Sector Count”, check it with the command line tool devkit-disks by running:

sudo devkit-disks --show-info /dev/sda

Changing the /dev/sda to match whatever disk you want to check against.  If you’re not sure what /dev device to look at, you can run

sudo fdisk -l

To get information on all the hard drives in your system.

As a general disclaimer: Use this information at your own risk, and don’t blame me if you screw everything up.

I posted recently in wipe your… about secure document deletion.  Until today, I hadn’t tried any of the methods mentioned in that post for securely deleting individual files.  So, since I needed to securely delete some files, I finally gave it a go.  I used shred to delete some files.

Read the rest of this entry »

Linux Journal had a tech tip on how to save an online video to your hard drive: Tech Tip: Save an Online Video with your Browser (no extensions needed)

This totally works. However, I found a simpler solution than their method. So far, every Flash video I play ends up in /tmp as an extention-less file that begins with “Flash”. Try running

ls /tmp | grep Flash

If you get just one return, then you can run

find /tmp -name "Flash*" -exec cp '{}' flash.flv ';'

This will find anything in /tmp that starts with “Flash” and copy it to your home folder as “flash.flv”. Of course, you still have to wait until the video finishes buffering before running the find command.

Previously I posted, pointing to a tutorial on converting AVI files to DVD. The tutorial below builds on that one, using different tools for the conversion of the input file to an MPG format.  Please be aware that the DVD created by following these steps will not have a menu.

Read the rest of this entry »

Get ubuntu-restricted-extras and a lot more.  Check out the Ubuntu Karmic Koala 9.10 Post Installation Guide.

Bulk rename files – from the GUI or the command line

When I started usng Xubuntu last year, I was really impressed with the Thunar file manager’s plug-in for renaming multiple files.  In fact, when I switched over to using Gnome, I made sure to install Thunar to keep that amazing functionality.  I use it all the time for cleaning up directories of media: pictures from digital cameras, music files, videos.  You can use it for folders as well as files.

Read the rest of this entry »

Check out the following articles for how to use a Linux tool called chntpw (which being translated means: change NT password) to delete a Windows password.

I have used a live-cd that I found here to delete passwords before.  Basically, it boots up a minimal Linux instance and uses the chntpw to delete the passwords.  This tool has the added benefit of automatically finding the location of the SAM file.  The guides above, however, have the benefit of working from any live-cd that has an internet connection (so you can use apt-get to install chntpw).

Get it via torrent.