Deleting files with special characters

You can delete a file with strange characters (especially hidden characters) by it’s inode number.

To find the inode number of a file, list the directory with the -i option:

ram# ls -i
2064227 test

2064227 is the inode number of the file ‘test’.

Use the find command to delete the file by it’s inode number:

find . -inum 2064227 -exec rm {} ;

HP DV2610US & Ubuntu Gutsy Gibbon (7.10)

GUI Installation

DO NOT use the GUI installation method. It does not work. It will make you feel really bad for buying this laptop. Worry not. Use the text based installation. Once the installation is complete, it will come up with the GUI with restricted resolution.

Make sure you are connected to the LAN (and of course, you should be connected to the net). (Wifi does not work at this point). It will prompt you to install/use the restricted drivers for nVidia. Say Yes ! It will install the drivers. Reboot. You should have a proper display/resolution now. (It will prompt you to install the “drivers” for broadcom wireless. Do not proceed. They don’t work and you won’t need them).

Networking

In order to use the Broadcom Wireless card in HP DV2610US (and I think it also works on the recent AMD/Nvidia based laptops), you need to do the following:

  1. Disable the restricted drivers. You dont need them. The only way it all works is with ndiswrapper
  2. Install ndiswrapper (apt-get install ndiswrapper-common or ndiswrapper)
  3. Disable any Competing Drivers
    Ubuntu has a kernel driver for this device that is called bcm43xx. In order to use ndiswrapper you must put the bcm43xx in the black list file.

    echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist
    

    The blacklisted module will not be loaded on reboot from now on.

  4. Download the “windows” driver from HP support
    user@ubuntu:~ $ sudo wget ftp://ftp.hp.com/pub/softpaq/sp33001-33500/sp33008.exe
    

    If the above driver does not work, try

    wget ftp://ftp.compaq.com/pub/softpaq/sp34001-34500/sp34152.exe
    
  5. Install Cabextract. Cabextract will be used to “extract” the windows drivers from the exe file.
    user@ubuntu:~ $ sudo apt-get update
    user@ubuntu:~ $ sudo apt-get install cabextract unzip
    user@ubuntu:~ $ cabextract sp33008.exe
    
  6. Install the drivers:
    user@ubuntu:~$ sudo ndiswrapper -i bcmwl5.inf
    

    You should notice something like this (and it is normal)

    installing bcmwl5 ...
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    forcing parameter IBSSGMode from 0 to 2
    
  7. We can list the drivers, to make sure we have it installed properly
    user@ubuntu:~$ ndiswrapper -l
    installed drivers:
    bcmwl5          driver installed, hardware (14E4:4324) present (alternate driver: bcm43xx)
    
  8. Bring up the driver:
    user@ubuntu:~$ sudo depmod -a
    user@ubuntu:~$ sudo modprobe ndiswrapper
    
  9. This should bring up the driver. Reboot. Once you are back in the GUI mode, you should see that Wifi is up and you are shown the nearby networks

Checking URL link status with Perl

I had a file with lots of URLs but were not sure which ones where active or which links were broken. I used the following Perl script to check the status of the links.

#!/usr/bin/perl -w

#########################################
# link_check.pl - link check script     #
# Ram Prasad, 2007, ram_megalinux.net   #
#########################################

use strict;
use warnings;
#use File::Basename;
use LWP::UserAgent;

# toggle debug mode
my $DEBUG = 1;

my $browser = create_lwp_browser();

# do the work and check the remote pages
my ($working, $broken, $odd) = get_status_codes($browser);

#------------------------#
# subs, funcs and utils
#------------------------#

sub get_status_codes
{
my $browser = shift;
my $file='urls.txt';
open (INFO,$file);
my @lines = <INFO>;
close(INFO);
foreach my $p (@lines)
{
chomp($p);
my $response = $browser->get($p);
warn "Working on ", $p, "...n" if $DEBUG;
print($p."|".$response->status_line."n");
}
}

#------------------------#
sub create_lwp_browser
{
# set any LWP settings here.  agent, proxies, follow redirects etc
my $browser = LWP::UserAgent->new;
# get the proxy env variable from command line
$browser->env_proxy;
# default time out per URL checked.
$browser->timeout(30);
$browser->agent('link_check.pl/1.0');
return $browser;
}

#------------------------#

In the above example, “urls.txt” contains the list of all URLs.