Find and Remove Files That Have Spaces In The Name

Whenever I need this, it takes me seemingly forever to figure this out. Blog it!

‘find’ is a great GNU utility for digging up files in directories. ‘rm’ is a staple command for any linux user. Combining the two commands can be fun and powerful.

find /home/luser -type f -name '*.mpg' -exec rm -f {} \;

The above command calls ‘rm -f’ for each file. A faster version of this uses xargs for a single call.

find /home/luser -type f -name '*.mpg' | xargs rm -f

Hooray! We just deleted all mpg files in luer’s home directory. Unless, of course, any of those files had a name that included a space. Doh! One way to get around this is to use this modified version of the above command.

find /home/luser -type f -name '*.mpg' | tr "\n" "\000" | xargs -0 rm -f

Update: As Stuart notes in the comments, you should be able to replace the ‘tr’ command with the find -print0 option. I wasn’t able to get it to work, but maybe it helps you!

find /home/luser -type f -name '*.mpg' -print0 | xargs -0 rm -f

Update #2: As Ole notes in the comments, GNU parallel is another option which provides parallel process running.

find /home/luser -type f -name ‘*.mpg’ | parallel rm -f
Advertisements

Clicking Things

For a month or so now, I’ve been having problems with clicking buttons in Eclipse and in Flash. After asking in the Eclipse IRC room, I was able to find an answer that actually fixes both Eclipse and Flash.

Eclipse (from the wiki)
I’ve created a startup script that sets the following system property.

export GDK_NATIVE_WINDOWS=true

Flash (from this post)
Pretty much the same fix as above but made in a different place. In /usr/lib/nspluginwrapper/i386/linux/npviewer, add the following:

export GDK_NATIVE_WINDOWS=1

before the line:

. /usr/lib/nspluginwrapper/noarch/npviewer

A note to all this. Don’t put either of these properties in .profile, .bashrc or anything like that. This property needs to be set specific to things that break as this changes how GTK+ processes events.

Google Gears for 64-bit Linux

While this isn’t really news at this point, I figure spreading the word can’t hurt. I use Gmail and several of the other Google applications (calendar, reader, docs, etc). Google has added offline support to a few of these apps via their Google Gears Firefox addon. This can be great news unless you are running 64-big linux. There is not an official release of Google Gears of 64-bit linux. There is, however, an unofficial and totally sweet build available. The builder does a great job of staying up to date with the builds usually within a release or two of the official builds. If you travel or just like to handle email and such when offline, this can be a great help. Enjoy!

Linux seen through different Windows

I’m a sucker for new features. I love to see new gadgets, widgets and UI updates but shy away from bells and whistles. After the shininess has dulled and the day-to-day functionality is what I’m left with, I tend to go with function & performance over form. For that, I tend to try a new window manager or desktop environment about every 6 months on my linux installations. I’ve just recently moved from LXDE to KDE (4.2) to Gnome (2.24.1). Here are my thoughts for what they’re worth

LXDE

After a resource battle with an older version of Gnome, I decided I needed a slimmed down, more responsive window environment. I looked around but didn’t want to go with something terribly barebone. Ratpoison is for crazy people but I wanted something a little more updated than Fluxbox. This led me to Openbox. After tinkering with it for a bit I found someone had created a nice little desktop environment based on Openbox called LXDE. This gave me a few nice little applications but was largely disconnected in that it only supplied the applications and didn’t integrate them like the bigger desktop environments.

My usual six month trial went well and I generally enjoyed LXDE. It’s very responsive, didn’t feel buggy or missing features. This is not an environment for everyone though as it is pretty minimal but that is what I was looking for. I was never quite able to get startup scripts to take affect as I had in Openbox alone but that wasn’t a big deal since I wanted only a couple and they were optional. All in all, LXDE was a good experience.

KDE

After hearing all the hoopla over KDE’s big release of the 4.x series, I decided to finally give it a shot. Now, when I say hoopla, don’t misconstrue this as all cheers or all jeers; the response was pretty mixed but overall positive even through Linux dumped it. The new menu options looked pretty nifty and some of the UI changes and methodologies were nice as well. My biggest problem with KDE 4.2 is its missing attention to details. Menus don’t properly change text color when hovering which can make for unreadable menus when you have black text and a dark blue highlight. Another issue is the clunky feel and slowish response of the menus. There might be a setting for this but that’s another lack in KDE of late: configurability. Basic things in a windowing environment should be quick and crisp but I didn’t find this to be the case. I didn’t even bother with the wacky effects so I think it is something more integral to KDE.

I was on KDE 4.2 for a month or two and decided to move to something else. Many of the things I have issue with are being addressed in 4.3 but I need usability today. I’m sure I’ll keep updating my KDE libs as time goes on and switch back over to test usability now and then.Link

Gnome

A perennial favorite of mine. Gnome’s focus on stability is very appealing to me while its rate of change in UI can be liked to that of watching paint dry but that keeps it very familiar. This is the desktop environment I’m in now and have been for only a day or two. So far the environment is very crisp, no funky loss in the details and even handles startup script failures very nicely which neither of the previous environments handled at all. Ubuntu has poured a good bit of effort into Gnome which keeps it advancing without losing stability. Some Ubuntu features have created more problems than helped (indexing) but those are usually easily disabled.

The big difference between roll your own setups and true desktop environments is the creature comforts they give you. LXDE is really just a gathering of applications while KDE and Gnome really try to greet you with nice things. Sound configuration, extra keyboard buttons detection, network manager and device detection are just some of the niceties you get with the big guys. Along with that comes system overhead but I just upgraded to 4GB of RAM so I can afford it for now.

All in all, I tip my hat to Gnome for being the wife of desktop environments. It has great stability, will be there when you need it and communicates well with you. KDE is the old girlfriend that you drunk dial from time to time and alway like to talk about how hot she looks (Opera hangs out here, too). LXDE is something you did in Vegas and only tell a few people about. You might do it again if you go back to Vegas but you can’t really talk to anyone about it except the people that were there. While stability is great, ogling that old girlfriend can be fun and Vegas is exciting but draining. The beauty of this comparison is that these are analogies and you don’t lose have of your personal worth by trying different things.