Archive for the ‘gnu’ Category

comm — when diff won’t do

Thursday, August 7th, 2008

Don’t get me wrong, I appreciate the utility of diff. I use diff all the time. Unfortunately, there are times when I don’t want a diff output.

Case in point: I was comparing two lists of accounts. I wanted the accounts that were present in the newer file. Diff gave me output, but the diff output wasn’t what I wanted.

comm is handy for this. You would do the following to get the list I want:
comm -1 -3 oldfile newfile

Lovely! comm is actually part of the GNU Core Utilities and was written by Richard Stallman and David MacKenzie. That confirmed my suspicions that comm subscribed to an old UNIX adage for some utilities: Do one thing very, very well.

I have nothing more to say about comm, you’ll have to wear it out yourself.

Until next time,

-LightningCrash

Getting Linux functionality on a Windows desktop.

Friday, September 14th, 2007

When I was forced to run Windows in a support environment, I was faced with a number of challenges. Mainly, how to get my favorite OSS functionality back in my Windows desktop. Luckily, there are many tools that can help you.
I’ll go through them in the order I usually install them on a Windows box, and add in some others that I’ve found and considered.

  1. BBLean
  2. BBLean gives you a Blackbox environment in Windows. I like BlackBox, especially in a Windows environment, and it’s probably the biggest visual indicator that you’re making progress in getting OSS on your Windows box.

  3. UnxUtils
  4. Oh how nice it is to have native GNU tools in Windows. I put the utilities into the Windows/System32 folder, renaming find.exe to gfind.exe, as Windows won’t let you replace find.exe (Who knew?)
    Notable programs in the package include dd, diff, grep, find, head, tail, gzip, gunzip, wc, tr, sed, gawk, and touch.

  5. Cygwin
  6. From Cygwin.com: “The Cygwin tools are ports of the popular GNU development tools for Microsoft Windows. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect.”
    Worth the install, definitely.

  7. GnuWin32
  8. GNUWin32 has Windows ports of GNU or other open source software. The list is much more comprehensive than UnxUtils, and you can pick and choose which packages you want to download. Useful if you want a native version of a specific tool not included in UnxUtils.

  9. PuTTY
  10. PuTTY gives you SSH to other machines, and also includes SOCKS proxying, port redirection, SCP, SFTP, and other useful tools for the command-line.

  11. BitVise Tunnelier
  12. This item isn’t GPLed, so it diminishes its value in my mind. However, if you need an easy client to just run a SOCKS proxy, do graphical SCP, or run SSH tunneling of any kind, the BitVise Tunnelier client is great for this. I don’t use it for CLI administrative tasks, as PuTTY does better terminal emulation, but it’s still very good at what it does. If you’re SSHed into a Windows box, it will let you do one-click, SSH Tunneled Remote Desktop sessions to the box you’re SSHed into. Which leads me to my next item….

  13. BitVise WinSSHD
  14. If you’re not a big fan of Cygwin but still want to SSH into a Windows box, get WinSSHD. This is a closed source SSH server for the Windows environment that runs as a service. It costs money, though, $40 for a personal license and $100 for a business license. This also only gives you 5 user licenses. Closed source, costs money, and a diminished value in my book. May be necessary for some, though.

  15. WinSCP
  16. If you wish they made a SmartFTP-like application to do SCP file transfers in Windows, you’re in luck. This program is open source and free as in beer. It’s definitely more secure than plain FTP, and the program is very polished. Tunnelier does some of the same things, but for large or complicated transfers, this is the way to get it done. Plus, Tunnelier is closed source.

  17. Unison
  18. There aren’t any particularly good Rsync options for Windows (except for via Cygwin), but Unison comes pretty close and brings you a lot of the same features. To synchronize folders, there is no other. Unison is also open source (GPL) and free as in beer!

You can find a veritable gaggle of other Open Source windows software via the OSSwin site. So if there’s something else you like in Linux but want in Windows, you might just happen to be in luck. We still don’t have Yakuake/Tilda or Compiz Fusion on Windows yet, but this will make Windows more tolerable for OSS geeks like myself, and give more functionality to the Windows power users.
That’s a Win/Win in my book.

Did I miss anything? If so, use the comments section to slap me upside the head.

Until next time!
-LightningCrash

The 10 most useful applications in Ubuntu

Wednesday, August 22nd, 2007

Many of these applications are the reason I switched to Ubuntu at home, and I have made them a staple of my technology lifestyle. If you’re someone who has just gotten started tinkering with Ubuntu (or GNU/Linux in general), you should give these a shot.

10. vim / gvim
Vim is the editor of choice for everything I do (well, except excessive copying and pasting from Firefox.) The capabilities of vim will far exceed anything I’ll ever do with it. Periodically, though, I have to do something ridiculous to a file, and vim saves the day. Want to run a macro that will trim the first three characters off of every line in a file, add a semicolon at the end of every line, and replace every instance of FOO with BAR? Vim can do it. To install, simply the following a command prompt:

sudo apt-get install vim

Now you can execute vi (or vim) from the command prompt and get to editing away. Here’s a cheatsheet for how to get around. There are hundreds of pages about the vim editor, search the net to find more!
Even if you run Windows, you can still enjoy some of the vim goodness. Just to go www.vim.org and grab the Win32 Installer. You won’t get the command-line vim, but you will get the always-handy gVim.

9. The GNU find command
The GNU find program is part of the Ubuntu default installation, so there is no need to install it.
A lot of people rely on the locate command to find files, and that does serve its purpose very well. Where the GNU find command is useful is finding files of a specific nature, or acting upon those files in particular. For instance, if you want to get the MD5 checksum of every file in a directory, just CD to that directory and execute the following at the command prompt:

find ./ -type f -exec md5sum {} \;

You can even use the GNU find command to delete files that haven’t been updated in a given timeframe (for instance, log files older than 90 days.) First, you should open a terminal and cd to the directory with the log files, usually /var/log. Then, running the following will print those files to the command line:

find ./ -type f -mtime +90

Adding -delete to the end of that line, and executing it again, will delete all files older than 90 days in that folder and every folder underneath it, as long as your user account has file permissions to do so!

8. Midnight Commander
If you remember Doubletree from the DOS days, then Midnight Commander will probably be your new best friend. If you haven’t enabled the additional apt-get repositories yet, please visit the Ubuntu Guide and complete that before taking the next step.
To install Midnight Commander, type the following at a terminal prompt:

sudo apt-get install mc

Midnight Commander is great for traversing the filesystem quickly, and even moreso when you’re doing the same remotely via SSH. You can edit files from within MC, and even browse a remote filesystem via an SSH connection with it (and without installing SSHFS.)
To run, simply open a terminal window and execute ‘mc

7. Mplayer
I know you can get mplayer for Windows, but it’s just not the same. Again, you’ll want to visit the Ubuntu Guide to enable the additional apt-get repositories if you haven’t already. To install mplayer, open a terminal window and execute the following:

sudo apt-get install mplayer

Mplayer has a special place in my heart as the media player that would play just about everything, even in the days when other players wouldn’t. Other media players have made some headway, but mplayer still has tricks up its sleeves. It will even play VCDs directly from a .bin file!

6. Rsync
Looking back, this was probably one of the main reasons I went to Ubuntu at home. There is just not a suitable Rsync application for Windows. Period. I have a directory that follows me around wherever I go, it resides in my home directory as ’sync’. When I log in at work or on my laptop, it is copied down from my main desktop at home. When I log out, the directory is synchronized back with my main desktop at home. Here is a great article from Linux.com detailing how to use rsync in some practical ways. To install rsync, pull up that terminal prompt and type:

sudo apt-get install rsync

5. Alltray
Alltray allows you to take any window and minimize it to an icon. If you like the way that GAIM/Pidgin stashes away, and want other windows to do the same, try out Alltray!

sudo apt-get install alltray

After you’re done installing, go to Applications->Accessories->Alltray, then just click on the window you want to turn into an icon. To bring the window back, just click on the icon.

4. TightVNC Server
Oh, I know what you’re thinking: “TightVNC is available for Windows, LC! Why is this worthy of mention?!” The Windows TightVNC implementation allows you to remote in to your existing desktop. The Linux implementation, however, allows you to remote in to a discrete desktop environment. You can even run multiple discrete VNC servers on the same Ubuntu box. I use this to give an Xorg environment to items I want to leave running all the time. Azureus, among other applications, stays running in the VNC session and I can check up on my seeding efforts from afar. To install, simply open a terminal window and execute the following:

sudo apt-get install tightvncserver

To run a VNC server, simply execute ‘vncserver‘ from any terminal. You can set a password for the VNC server by executing ‘vncpasswdfrom a terminal. You can automate the startup of vncserver, but I usually just launch it when I need it and then tromp around from there.

3. Fuse SSHFS
Got SSH access to another computer, but want to view the files on that computer as if they were on your own filesystem? SSHFS has you covered. The Ubuntu Blog has a better HOWTO on this than I could ever write, so go pay them a visit. I find SSHFS very handy when I want to listen to my home music collection from another computer on another network, but don’t want to carry multiple copies of everything around with me. Editing PHP files on my remote webserver got a lot easier, too.

2. SABnzbd
If you download anything at all from Newsgroups, you’ll appreciate some of the things that SABnzbd offers. SABnzbd will download, PAR check, unRAR and clean up any NZB that you throw at it. It offers a web interface and will monitor a directory for automatic pickup. I installed SABnzbd manually, but you can always check out this thread on the Ubuntu Forums to pick up a script that will install everything for you. There are no packages in apt-get repositories to install SABnzbd, so everything must be done the less convenient way. The results are well worth the effort, though.

1. Yakuake
If you’ve ever played any of the Quake series games (or games derived from iD software game engines,) you probably remember hitting the tilde (~) key to bring down a console where you could mess with game settings. Yakuake stashes a terminal window in the same manner, tied to the F12 key. You can reassign the key to any keystroke or combination that you like. I have mine set to CTRL + * at work (since they’re right next to each other on a Northgate keyboard), and Windows Key + Open Dialog Menu Key on my personal machines.
To install, execute the following at a terminal prompt:

sudo apt-get install yakuake

To run, type ‘yakuake &‘ at a terminal, and you should see a message that Yakuake started! Now you have a stowable terminal at your fingertips. Just press F12 to make it drop down.