You are currently browsing the category archive for the ‘open source’ category.

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 »

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

Get it via torrent.

The other day, a co-worker was in my office, and we needed to search for a spreadsheet on the server shared drive. I (shamefully) had to boot up my VirtualBox instance of XP in order to use the gui search function in it. All the while I kept thinking, “A real nerd would know how to do this at the command prompt.”

So today I did some research. I had already heard of the tools find and locate.  And I have been using grep in different situations (like to limit results from other commands).  But I never really knew how to use these tools to find exactly what I was looking for.  Fortunately (and this is one of the best parts about using Linux) many nerds have gone before me and documented what they know.  So a simple Google search is often all it takes to step up my Linux game.

Read the rest of this entry »

I found a great explanation of using regex with OO.o’s search and replace feature in Writer: Searching and replacing paragraph returns (carriage returns), tabs, and other special characters in OpenOffice Writer.

Cut & Paste Chmod Calculator, where have you been all my life?

Thanks to the Masters of the Linux Universe for pointing this out to me.

Gentoo Peeble mentioned a Space Invaders clone hidden in Calc. A quick Google search revealed a few more easter eggs noted on the OO.o wiki.  Although, I couldn’t get the Tic Tac Toe to work for me.