Tag Archives: Linux

Delete File with Dash/Hyphen in Name Within Linux/Unix

If you have a file named “-file” without the quotes, you would typically delete it using:

rm -rf -file

Except that doesn’t work. My CentOS complained to me with the following message (though not all operating systems may supply this, so this is mainly for those whose OS does not supply this tip):

rm: invalid option -- 'l'
Try `rm ./-file' to remove the file `-file'.
Try `rm --help' for more information.

The suggested tip here works well. Simply running the following command should delete the “-file” file.

rm -rf ./-file

Keep in mind this limitation does not apply only to the rm command, but a large number of commands including touch and others. It is the most annoying for the rm command, since you are trying to remove the file. For these other commands, you would also have to prepend the file name with a ./ in order for this to work.

OpenSUSE 11.4 on MacBook Wireless Setup

Recently, I’ve been testing out numerous different operating systems on my late-2009 MacBook. One of the operating systems that I’ve been playing with is OpenSUSE (version 11.4). One of the things that didn’t automatically work on the Live CD is wireless/WiFi. This tutorial will show you how to fix it and make wireless work for OpenSUSE on your MacBook.

To begin with, you need to know what kind of Linux kernel you are currently running. The kernel type should be either default, ec2, pae, ppc64, trace, vanilla, or xen. To find out, execute the following command:

uname -r

In my example, the output is 2.6.37.1-1.2-default. This means the type of kernel I have is ‘default’. You will need to know this for a step later on.

Now, you will have to add OpenSUSE’s wireless drivers repository to your computer. The simplest way to do this is via command line, otherwise known as Terminal. Execute the following command:

sudo zypper -v ar http://download.opensuse.org/repositories/driver:/wireless/openSUSE_11.4/ opensuse-wifi

Now, you will install the madwifi driver, which provides support for the wireless card within the MacBook. You will have to run the following command:

sudo zypper install madwifi madwifi-kmp-<KERNEL TYPE>

You will have to replace <KERNEL TYPE> with the kernel type you figured out previously. For example, I will have madwifi-kmp-default in my command. After executing the command, you will be asked whether to reject or trust the signing key for the package. After the command has been executed, give it some time. You may be asked a question with regards to the package’s key. You will also be asked to install the package. This part should be self explanatory for the most part.

After the command finishes executing, madwifi will have been successfully installed. To activate madwifi, use the following command:

sudo /sbin/modprobe ath_pci

To test if it’s working, execute use the following command:

sudo /sbin/modprobe -l | grep ath

If you get something like the following, most likely madwifi is working. All you have to do now is connect to a wireless network!

linux@linux:~> sudo /sbin/modprobe -l | grep ath
kernel/drivers/net/wireless/ath/ath5k/ath5k.ko
kernel/drivers/net/wireless/ath/ath9k/ath9k.ko
kernel/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
kernel/drivers/net/wireless/ath/ath9k/ath9k_common.ko
kernel/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
kernel/drivers/net/wireless/ath/ar9170/ar9170usb.ko
kernel/drivers/net/wireless/ath/carl9170/carl9170.ko
kernel/drivers/net/wireless/ath/ath.ko
kernel/drivers/md/multipath.ko
kernel/drivers/md/dm-multipath.ko
kernel/drivers/staging/ath6kl/ath6kl.ko
kernel/drivers/bluetooth/ath3k.ko
updates/ath_hal/ath_hal.ko
updates/ath/ath_pci.ko
updates/ath_rate/onoe/ath_rate_onoe.ko
updates/ath_rate/sample/ath_rate_sample.ko
updates/ath_rate/amrr/ath_rate_amrr.ko
updates/ath_rate/minstrel/ath_rate_minstrel.ko

To use Wifi, click on the Network Management icon in the taskbar (the right-most one in the screenshot below). To connect to a wireless network, click on “WLAN Interface”. The steps from there should be quite self explanatory.

You have new mail in /var/spool/mail/root

Every so often while I’m in SSH, I would get an alert:

You have new mail in /var/spool/mail/root

It’s just an alert, but it gets annoying seeing it appear after every single command. After searching around the web, I found a very simple way to get rid of it, using the following command.

> /var/spool/mail/root