[ Table of Contents ] [ Front Page ] [ Prev ] [ Linux Gazette FAQ ] [ Next ]

"Linux Gazette...making Linux just a little more fun!"


More 2¢ Tips!


Send Linux Tips and Tricks to gazette@ssc.com


Removing "Strange" files (response)

Sun, 30 Jan 2000 05:02:06 -0800
From: Jim Dennis <jimd@starshine.org>

Last month there was a shell script offered by Mendel Cooper <thegrendel@theriver.com> for removing files with degenerate names. That is to safely unlink those filenames containing "special" or strange characters.

It appears to be a dangerous script, and is probably not the best was to accomplish his stated goals.

There is no reason to blindly and indiscriminately remove all files containing whitespace, and the character set [+{;"\=?~()<>&*|$]. There is good reason to warn the sysadmin about the existence of such filename/links in the "common" areas of the file hierarchy.

In fact this particular set of characters seem arbitrary. For example why include the "open curly brace" and not its closing counterpart? Experience has shown that one is much better off using converse logic in these cases. In other words, one should define a set of the characters which are definitely to be allowed in filenames rather than trying to think of all the characters that "might be bad."

To safely find all files with such strange characters one can use a command like:

       find / -name '*[^][a-zA-Z0-9#%~:,._+-]*' 
... this defines a list of characters which I allow in my filenames: alphanumerics (a-zA-Z0-9), the square brackets ([]) --- note that /usr/bin/[ is a standard link to the /usr/bin/test command --- a few bits of punctuation that are occasionally found in filenames (such as the "dot" and "tilde" characters).

Note that even this liberal list of allowed characters isn't liberal enough on my Debian and S.u.S.E. systems. I find some "accented" (High ASCII) character filename links among some of the fonts and console/kbd map packages. I find that many MP3 files contain spaces, ampersands, and apostrophes.

In order to see characters that might not be displayed correctly by your terminal you can use the "-v" option to the cat command like so:

  find / -name '*[^])}{([a-zA-Z0-9@#$&"'"'"'%~:,._+-]*' | cat -v	

... here I've even further liberalized my character set even to allow single and double quotes to be allowed. The part of this that might be confusing bears explanation:

       	
   [^])}{([a-zA-Z0-9@#$&"'"'"'%~:,._+-]
                        ^^^^^^

Here I'm adding the double quote (which is quoted from the shell by the single quote way back at the beginning of this argument), then I'm ending the current single quoted context and immediately starting a double quoted one context. This is still part of the same shell argument (since I haven't introduced any unquoted whitespace, or anything that is in a normal IFS). Then I have a single quote (which is quoted by the double quotes) and a terminating double quoted (ending that string), and another opening single quote which goes to the end of the argument.

It's ugly, but it is the easiest way to put a literal single quote into a shell argument. (There are a number of characters that are "special" or that have "metasyntactic" implications when they are in a double quoted context, but only the single quote is significant inside of a single quoted context.

Note also that I use the dash character as the last one inside my character class. That to indicate to the regex/globbing engine that this particular dash represents itself (a literal dash) and that it is NOT operating to indicate a range of other characters, as it is when it appears in the a-z, A-Z, and 0-9 sequences. Similarly I have the closing bracket as the first "normal" character after the opening of the class and the "negation" operator. The regex/globbing engine that's used by find, bash and the GNU utilities is well written enough to distinguish between the literal inclusion of these "special" characters and their other uses within the regex/glob character class defining syntax. To allow the use of the "^" (circumflex or "caret" ) character we can include an additional instance of it later in the class definition (anywhere other than the first or last character of the sequence).

This regex "class definition" sequence is quite an advanced topic, so it is easiest to use it as an example so long as you understand what it does. In other words you can safely use this example even if you don't understand how to create such a pattern --- just be sure that you know what it DOES.

To safely remove a file with special characters in its name one can use a syntax like:

       find . -maxdepth 1 -name .... -print0 | xargs -0 rm
... note that those are "zeros" in the -print0 'find' directive and the -0 option to 'xargs' These "zero" arguments work together to ensure that the filenames are passed from the 'find' process to the rm command as NUL terminated strings. The ASCII NUL character (the 0-th in that encoding system) is really special and it really can't be embedded in a filename.

There are some other GNU utilities that accept a -0 or --null option to allow 'find' to pass NUL-terminated arguments to them including GNU tar and cpio.

The ellipses in this example can be replaced with any globbing pattern that exclusively matches the file(s) to be removed. Use the find command into a 'cat -v' process first to be sure that it only lists those file that you really intend to remove. Of course the . argument could be replaced with any directory name or list of names.

Incidentally, the reason I came across this is because I'm starting work on a "Linux Tips fortune cookie" file.

Mendel Cooper responds:

That is correct, in the sense that all administrative tools, utilities, and scripts are dangerous, especially those affecting the filesystem. Any script coming from an outside source that is used blindly and without understanding is dangerous.


2C Tip

Wed, 12 Jan 2000 18:18:58 +0100 (CET)
From: Flavio Poletti <poletti@writeme.com>

I've read the 2C Tip from Pat Bateman <pat99@linustart.com> and I found it useful. I wrote a small Perl script that inspects all open ports and reports about them. I want to share it with the others - and also ask you to check if it works or if it is not useful!!!

showports.pl

Good bye,

Flavio Poletti.


Quick html browse / edit

Wed, 19 Jan 2000 00:22:45 +0100
From: Paco <fmunoz@geocities.com>

If you want to edit your HTML code you have some choices, most of them only allow you to change your bare code in a non Visual method. This can be viewed as drawback but after the design of the 1st file of a given set must of the work is Cut & Paste, so you can use the Netscape editor to create the template them clear all the junk code that it write and then use one of the following options:

 - Just an editor and and your favorite browser
 Lynx, Netscape, konkeror ..... and another windows with vi, pico, joe, emacs or
somethings more "WYGIWYSish" 
 Use: Just from X, lauch all that you want and don't forget to reload your pages
after saving them

 - mc 
  midnight command can let you see html files (rendered by lynx) and edit them
with cooledit (Warning this a a console tool !! If you use one of them too
much you could end as a Computer Guru years later ! )
   Use: Just open a console and tipe mc (Most distros) browse with the arrows,
read files with F3/enter and edit them with F4


 - emacs : This "editor" have some features that help you to browse and edit your
html files. Is there anything that can't be programed in it? ;-)  
 Use: Just read all the emacs docs, and launch it (either in X or console)

 - Amaya lets you update your changes automagically and give you a treelike
view of your code's structure. (nice feature if you use a lots of tables) Made
by the w3 consortium, see http://www.w3.org 
 Use: Launched from X

 - One of the KDE tools :
  KDreamSite see http://www.raverx.seite.ms 
  WebMaker see http://www.services.ru/linux/webmaker 
  KWebDeb see http://mason.gmu.edu/~ebanker/kwebdev/index.html 
 Use: Launched from X

  Galway (good !, GNOME html editor)  see http://erin.netpedia.net/
 Use: Launched from X

  There are also others 

  CoffeCup (good but not Open Source) ,
 tkHTML
 asWedit
 plexel
 ASHE
 Bluefish (Nice!) see http://bluefish.linuxbox.com/
 Bulldozer (designed by the NASA!)
 ewin
 

You can allways go to http://www.freshmeat.net or even www.linuxberg.org and search there for more stuff, I'm sure that this list is not complete.

I strongly sugest you to use some short of scripting or templates to create your pages. The target is to tipe your have your new text as plain text and get nicely formated html pages just a "click/script" away. (Perl anyone?)

Un saludo Francisco Muņoz


Yet another tip

Sun, 23 Jan 2000 16:22:57 -0700 (MST)
From: Mendel Cooper <thegrendel@theriver.com>

Hello again, LG people.

Here is another one for your 'tips' column.

It seems that "whois" queries are no longer quite the same. A simple "whois xyz.com" defaults to the Network Solutions server, but due to political machinations these guys are playing it tight lipped and have sharply restricted the amount of info returned on a "whois". If you need the in-depth goods on a domain name, you now have to turn to an alternate whois server, such as ripe.net.

The following script, named 'wh', will do a domain name lookup on any of three alternate whois servers. As root, save 'wh' to /usr/local/bin, and then create three symbolic links in that directory, like so:

[root /usr/local/bin]# ln -s /usr/local/bin wh /usr/local/bin/wh-ripe
[root /usr/local/bin]# ln -s /usr/local/bin wh /usr/local/bin/wh-cw
[root /usr/local/bin]# ln -s /usr/local/bin wh /usr/local/bin/wh-radb

The script can be invoked as 'wh zzz.com', which does a lookup of zzz.com on the ripe.net server. If invoked as 'wh-cw zzz.com', it looks up zzz.com on the cw.net server. If invoked as 'wh-radb zzz.com', it looks up zzz.com on the radb server.

These alternate servers unfortunately do not list as many domain names as the Network Solutions server, but they do provide a great deal more info on the ones they have.

wh


Tips in the following section are answers to questions printed in the Mail Bag column of previous issues.


ANSWER: Linux clickability in windows NT Domain

Fri, 31 Dec 1999 15:09:38 -0600
From: <tdierkes@home.com>

As a new feller, I'm flabbergasted that a question was asked that I KNEW!

Network Neighborhood is using WINS to resolve the IP addresses. The NT machines may have the correct domain name in there (DNS tab), but, on the WINS Addressing tab (start | settings | control panel | network | protocols | TCPIP | Properties | WINS Addressing) there is a check tab for

"Enable DNS for Windows Resolution"

That must be checked.

Or, you could have your Linux machine name added to the WINS server.


ANSWER: Making Linux talk to an NT network

Fri, 31 Dec 1999 16:08:52 -0600
From: <tdierkes@home.com>

David,

Use the Diagnostics found on http://us1.samba.org/samba/docs/DIAGNOSIS.html

You might be better to at least read the FAQ first http://us1.samba.org/samba/docs/FAQ/

I just got most of my Samba issues resolved this week. I also felt like I was spinning my wheels for a while. The Diagnostics will, besides help you identify your problems, will also point out what you need to do MOST, and that is, break your connectivity problems down into smaller bytes.

ie. Let us start with the 1st problem of your 10 Easy Step guide you suggested. Come back with the 1st specific problem and we can go from there.


ANSWER: linux on a laptop

Fri, 31 Dec 1999 16:53:47 -0600
From: <tdierkes@home.com>

Do not forget to check http://www.linuxgazette.com/wgindex.html which is the Linux Gazette search engine for anwers before asking. I searched on ATI rate and got a lot of responses.


ANSWER: Not a tip, but rather a question

Fri, 31 Dec 1999 19:08:30 -0500
From: Gerard Beekmans <glb@dds.nl>

Hi,

I'm looking to add "disk mirroring" (RAID-1) to a SUSE 6.1 system with an AHA-2940U2W.. I must be looking in the wrong places, but it seems like information about this particular issue is scarce at best. Any ideas?

An idea is to use Software-RAID. This eliminates the need of a hardware RAID controller.

What you need to do, is read the Sofware-RAID mini HOWTO. You can get this document from http://www.linuxdoc.org/

You might have the file in /usr/doc/HOWTO/mini/ (or whever your system stores HOWTOs) but there's a chance your local version is outdated. So download the one from the LDP site mentioned above to ensure yourself of reading the latest version.


ANSWER: pulse vs tone dialing

Fri, 31 Dec 1999 19:14:33 -0500
From: Gerard Beekmans <glb@dds.nl>

Hi,

currently my modem dials using tone, but my phone line needs pulse, how do fix it?

You need to modify your modem's dial string.

Currently, it says something like ATDT<here phonenumber>

Change this to ATDP<here phonenumber> and it'll dial in pulse-mode rather than in tone-mode.


ANSWER: Access 97

Sat, 1 Jan 2000 12:41:58 -0600
From: McKown, John <JMckown@Insurdata.com>

First, happy new year!

To the best of my, admittedly limited, knowledge, there is not a way to run Access 97 directly on Linux. I think that I have seen some Linux ODBC drivers which allow a Linux client to access an Access97 database running on another computer. In particular, on http://freshmeat.net/appindex/1999/12/07/944590737.html . This says that it allows a Linux client to talk to any NT ODBC data source. This, of course, requires running WindowsNT. You can do that by having two machines, one running Linux the other running WindowsNT. Network them together with a normal Ethernet connection. Or, you can purchase a product called VMWare (http://www.vmware.com). This product allows you to install and run a WindowsNT (or 95 or 98) system under Linux. Note - this DOES require you to buy WindowsNT! It is not an emulator of WindowsNT, it simply allows a real WindowsNT machine to run along with Linux on the same physical machine. I have used this product to run Windows98 under Linux and it does work quite well for me. VMWare allows the WindowsNT "virutal machine" to talk to Linux via a "virtual" ethernet connection.

Question, why must you use Access97? Linux has some nice database software that is free. I'm thinking mainly of PostgreSQL and MySQL. The main thing that they lack is a "builtin" GUI interface. But I'm sure that there are some out there. Probably in Perl or Python, both of which can "talk" to either of those database systems.


ANSWER: Re: pulse vs tone dialing

Sun, 2 Jan 2000 23:44:41 -0500
From: Pierre Abbat <phma@oltronics.net>

You need to change "atdt" to "atdp". Where you change this depends on how you are dialing and perhaps on your distribution. On a Red Hat or Mandrake system using "ifup ppp0" or UserNet, this is in /etc/sysconfig/network-scripts/chat-ppp0. In kppp, hit Setup, Modem tab, Modem Commands button. The config file is ~/.kde/share/config/kppprc if you need to edit it by hand or program.

phma


ANSWER: Running Microsoft Windows Apps on Linux.

2 Jan 00 12:38:23 ARST
From: Ivan Andres Hernandez Puga <iahp@usa.net>

Dear Rick:

Try with WINE (http://www.winehq.org). I have heard that you can run MS-Office and VisualBasic 6 using that program.

Luck.


ANSWER: Re: SNA Server

Tue, 04 Jan 2000 20:05:17 +0000
From: Burkhard Perkens-Golomb <perkens@sdm.de>

Just use metacrawler:

http://www.metacrawler.com/index.html?nocookie

and search for "sna linux" (without quotes).

There's even an GPLed SNA Server available.

Burkhard


ANSWER: Linux Red Hat installation kernel panic Unable to mount root

Thu, 6 Jan 2000 13:58:39 +0100
From: Ewan Gatherer (ECS) <Ewan.Gatherer@ecs.ericsson.se>

Hi

You should boot your linux box with the boot disk you created, or where meant to create when installing Linux. Once booted, if all goes well, you will have you linux box up and running. Then re-install lilo or your favourite boot manager by typing lilo. If you want to set the dos partition to startup by default use lilo -D dos.

If this does not solve your problem or things do not go as I mentioned above drop me a mail.

Best regards

Ewan Gatherer


ANSWER: Linksys Ether16 NIC installation issues, as asked in the Answer Guy, LG Jan 2k

Thu, 06 Jan 2000 14:33:19 -0700
From: Marcus Post <marcus.post@wcom.com>

From Chuck Whinney on Sun, 05 Dec 1999 I cant seem to get my Linksys Ether16 LAN card to work under linux. I turned off the PnP liek teh linksys website said, and I turned the motherboard setting from PnP on that IRW to the ISA setting. Linux still never recognizes it. Any ideas? Thanks! Chuck

I wanted to comment on this because some easy items where missed in answering this customer. THe chipset is fully supported, being an NE2000 clone that works just fine. If he is having difficulty installing it, here's where he should check:

#1 Conflicts. This is not likely a problem, since the Ether software that sets the IRQ and I/O of the card checks for conflicts before setting the resources. If you have not installed new hardware, or turned on any extra on board peripherals (Serial, Parallel, or USB ports), this shouldn't be an issue.

#2 How the driver is loaded. As a shot in the dark, you are likely using redhat, in which case the best choice is to use Linux Config to set up the module to load at boot. Most distros will work the same way, but some you have to manually edit rc.* files. THere is a linux-conf topic for network interfaces, but I forget what it is called ATM. If you have to edit the rc.* files, look for a rc.modules file; most distrobutions have one with the network card modules already specified, but commented out. Find the one with your module ( ne2k.o I believe) and uncomment it. In either case, don't worry about specifying the IRQ; you only need to note the I/O address for this card. *VERY IMPORTANT* when specifying the I/O port, use "0x320" instead of "320". You have to specify the number is hex, which is '0x'. So, if the software that disabled your plug n play on the card said it was using port "330", tell linux that the port is "0x330" Don't expect the module to autodetect the card: on this card, it almost never works (I own three of them personally), while autodetect works on other cards, such as my SMC. I don't know why, but don't count on the module to detect the card.

#3. I dont know about ISA IRQ changes you made in the BIOS. From personal experience, they just aren't needed. You sound comfortable enough with them, so you may want to change them back to normal once you are positve the Linux configurations are correct and complete.

#4 Standard troubleshooting: If you dont get an error when booting, check 'ifconfig'. You may just need to assign the card an address, subnet, et al. Or, run dhcpcd if you have a DHCP server/cable modem/DSL router/whatever. Try a different ISA slot. If all looks good locally, but you cant reach outside of your own box, check your cables, subnet mask. First answer if the problem is hardware or software. Tackle it logically.

Best of luck, Toodles


ANSWER: Win98 ICS + Linux

Fri, 07 Jan 2000 23:11:51 +0100
From: Anders Hoglund <anders.hoglund@linux.nu>

Hello!

It's easy to do that, run netcfg and click on "interfaces". Edit your "eth0" with "interface configuration protocol - dhcp", save and restart. After that it should work!

Sorry for my bad english!


ANSWER: Diamond SupraExpress 56i V PRO

Wed, 12 Jan 2000 15:40:19 +0100
From: Alberto Caso <caso@intermail.es>

Hi, I read your question on Linux Gazette #48 about installing a Diamond SupraExpress 56i V PRO under Linux and I have to give you bad news: it's a winmodem. Well, it is not a full winmodem, as it does data compression on the modem rather than on the PC, but it is partialy software-controled, so it will only work with the proper drivers installed. As the technical staff at Diamond told me (yes, I had a SupraExpress 56i V PRO), there are no plans to provide drivers for platforms other than Win32. I also emailed the developer support staff, but I got no answer from them. Alberto.


ANSWER: Suggestion and ideas

Wed, 19 Jan 2000 01:37:34 +0100
From: Paco <fmunoz@geocities.com>

Just read a Linux newbie guide and an Instalation guide. :-) Try not to read all the other stuff ... untill you need it or had finished the instalation (and everything is working)

1 To get out from a manual just hit q (From the origins of the Unix world q was the key to quit :-) You are right, This is said in noplace. I have figured in and old VAX some years ago just after 10 minutes (You have to log out before you could leave the terminal)

2 To copy a file use (much like the old MSDOS copy, well not really) use: cp file1 target where target can be a file or a directory (just type man cp, now that you know how to exit tit :-)

3 Pico is nice, In console mode I use the midnight commander to navigate the directories and just hit F4 to launch cooledit and edit files (Funtions keys hints are at the bottom of the screen) Very easy. I miss it a lot when I use the University Solaris box.

4 ????


ANSWER: Re: HELP with LT Win Modem and SB 16 >Sound Blaster wanted!

Thu, 20 Jan 2000 15:49:55 +1300
From: Greig McGill <rider@wave.co.nz>

Following up from your january issue, specifically:

From: Gerard Beekmans

It's true; Winmodems don't work under Linux. Winmodems are specially designed to work with Microsoft Windows and are not supported in Linux. The only way to get a modem to work is to buy a non-winmodem.

This is not strictly true...

Go to www.linmodems.org.

I managed to get my LT Winmodem going on my Acer notebook - runs sweeter than it did under win98.


This page written and maintained by the Editor of the Linux Gazette. Copyright © 2000, gazette@ssc.com
Published in Issue 50 of Linux Gazette, February 2000
[ Table of Contents ] [ Front Page ] [ Prev ] [ Linux Gazette FAQ ] [ Next ]