old-www/LDP/LG/issue53/lg_answer53.html

3418 lines
122 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.3D.f">
<TITLE>The Linux Gazette 53: The Answer Guy (TWDT)</TITLE></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<!-- *** BEGIN navbar *** -->
<A HREF="lg_bytes53.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<IMG ALT=""
SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom" >
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<A HREF="../faq/index.html"><IMG ALT="[ FAQ ]"
SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<IMG ALT=""
SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom" >
<A HREF="lg_tips53.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A>
<!-- *** END navbar *** -->
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="middle">
<font color="#B03060">The Answer Guy</font>
<img src="../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="middle">
</A></H1>
<BR>
<H4>By James T. Dennis,
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
LinuxCare,
<A HREF="http://www.linuxcare.com/">http://www.linuxcare.com/</A>
</H4>
</center>
<p><hr><p>
<!-- endcut ======================================================= -->
<H3>Contents:</H3>
<dl>
<!-- dt><a href="#tag/greeting"
><img src="../gx/dennis/bbub.gif" alt="(!)" border="0"
align="middle"><strong>Greetings From Jim Dennis</strong></A>
<dd>plus <a href="#tag/hgreeting"
><strong>&para;: Greetings From Heather Stern</strong></A></dl -->
<DL>
<!-- index_text begins -->
<dt><A HREF="#tag/1"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>Win4Lin and www.linuxdoc.org/LDP/LG/issue50/tag/26.html --or--
<dd><A HREF="#tag/1"
><strong>Win4Lin eMERGEs</strong></a>
<dt><A HREF="#tag/2"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Extracting a block of text from a file</strong></a>
<dt><A HREF="#tag/3"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>Please can you help ? --or--
<dd><A HREF="#tag/3"
><strong>Zipping Across the LAN</strong></a>
<dt><A HREF="#tag/4"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>accessing windows files --or--
<dd><A HREF="#tag/4"
><strong>Accessing Local MS-DOS/Windows '9x Drives/Disks from Linux</strong></a>
<dt><A HREF="#tag/5"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>co-processes --or--
<dd><A HREF="#tag/5"
><strong>More on &gt;&gt; zsh Co-processes</strong></a>
<dt><A HREF="#tag/6"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>Linux - AMD? --or--
<dd><A HREF="#tag/6"
><strong>Linux for AMD, Cyrix, etc</strong></a>
<dt><A HREF="#tag/7"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>rcp question --or--
<dd><A HREF="#tag/7"
><strong>UNIX User Tries Linux 'rsh'</strong></a>
<dt><A HREF="#tag/8"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Telnet</strong></a>
<dt><A HREF="#tag/9"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>unix system admin --or--
<dd><A HREF="#tag/9"
><strong>Getting Familiar with a UNIX System</strong></a>
<dt><A HREF="#tag/10"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>NT OS/2 --or--
<dd><A HREF="#tag/10"
><strong>Connecting NT and OS/2</strong></a>
<dt><A HREF="#tag/11"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>control another VT? --or--
<dd><A HREF="#tag/11"
><strong>"Temporarily Controlling a VT"</strong></a>
<dt><A HREF="#tag/12"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>question regarding adding pty's to my sunos environment --or--
<dd><A HREF="#tag/12"
><strong>Running out of Pseudo-tty's</strong></a>
<dt><A HREF="#tag/13"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>xdm wont start a session --or--
<dd><A HREF="#tag/13"
><strong>XFree 4.0 and &quot;:0.0 refused by server&quot; Errors</strong></a>
<dt><A HREF="#tag/14"
><img src="../gx/dennis/bbub.gif" height="28" width="50"
alt="(!)" border="0"
><strong>FW: Linux</strong></a>
<dt><A HREF="#tag/15"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>Which filesystem? --or--
<dd><A HREF="#tag/15"
><strong>Determining the Type of Each Filesystem</strong></a>
<dt><A HREF="#tag/16"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>4 questions --or--
<dd><A HREF="#tag/16"
><strong>Four Questions</strong></a>
<dt><A HREF="#tag/17"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>Kermit protocol --or--
<dd><A HREF="#tag/17"
><strong>G-Kermit: The GPL Kermit Transfer Package</strong></a>
<dt><A HREF="#tag/18"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>shell cannot see an existing file --or--
<dd><A HREF="#tag/18"
><strong><TT>./script:</TT> No such file or directory</strong></a>
<dt><A HREF="#tag/19"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>hello</strong></a>
<dt><A HREF="#tag/20"
><img src="../gx/dennis/bbub.gif" height="28" width="50"
alt="(!)" border="0"
></a>Shutting Down the "ping Daemon" --or--
<dd><A HREF="#tag/20"
><strong>Shutting Down the Ping Daemon: Revised</strong></a>
<dt><A HREF="#tag/21"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>run any remote X server at host box --or--
<dd><A HREF="#tag/21"
><strong>Remotely Executing Graphic Apps</strong></a>
<!-- index_text ends -->
</DL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<!-- A NAME="tag/greeting"><HR WIDTH="75%" ALIGN="center"></A>
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>Greetings from Jim Dennis</H3 -->
<!-- begin greeting -->
<!-- end greeting -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<!-- A NAME="tag/hgreeting"><HR WIDTH="40%" ALIGN="center"></A>
<H3 align="left"><img src="../gx/dennis/hbubble.gif"
height="50" width="60" alt="(&para;) " border="0"
>Greetings from Heather Stern</H3 -->
<!-- begin hgreeting -->
<!-- end hgreeting -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/1"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 1 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Win4Lin eMERGEs</H3>
<p><strong>From J. David Peet on Thu, 30 Mar 2000
</strong></p>
<!-- ::
Win4Lin eMERGEs
~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
I just ran across your article
</STRONG></P>
<P><STRONG>
www.linuxdoc.org/LDP/LG/issue50/tag/26.html
that talks a (tiny) bit about Win4Lin.
</STRONG></P>
<P><STRONG>
FYI, Win4Lin is now available. And if you are interested,
the full documentation is on-line on the TreLOS web site.
www.trelos.com. You can also order it via this web site.
</STRONG></P>
<P><STRONG>
In case you did not know, the Win4Lin technology has a long
history as "Merge" for SCO Unix. SCO has been an OEM of
our Merge technology for years.
Win4Lin is the Linux version of the existing current technology.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I didn't know that. I thought DOS/MERGE was from a
company called "Locus" or something like that.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
One minor point <TT>--</TT> Win4Lin is not a "clone" of VMWare as
such. They both provide a virtual machine to run Windows in on
Linux, but there are significant differences.
Refer to the new "white-paper" document:
<A HREF="http://www.trelos.com/trelos/Trelos/Products/Win4Lin_Whitepaper.htm"
>http://www.trelos.com/trelos/Trelos/Products/Win4Lin_Whitepaper.htm</A>
Near then end are two paragraphs that compare and contrast
Win4Lin <A HREF="http://www.winehq.com/">WINE</A> and VMWare.
</STRONG></P>
<P><STRONG>
-Thanks
<TT>-David</TT> Peet
<A HREF="mailto:david.peet@trelos.com"
>david.peet@trelos.com</A>
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I probably shouldn't have used the word "clone" <TT>---</TT> though
it isn't all that precise. Obviously, in light of Win4Lin's
heritage it might be more appropriate to say that VMWare is a
"clone" of Win4Lin's predecessor. MERGE is the grandaddy of
MS-DOS emulators for UNIX.
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, I'll let people make up their own mind based on their
own reading and experience.
</BLOCKQUOTE>
<BLOCKQUOTE>
I haven't actually used any DOS or MS Windows software in years
(only the occasional, blessedly brief trifle to help someone out
here or there). So even if you were to send a copy to me for my
evaluation I can't promise that I'd ever get around to trying
it. (I think I have a VMWare CD around here somewhere <TT>--</TT> an eval
copy or some such). Heather, my editor and wife, still uses
MS-Windows occasionally. I know she's installed <A HREF="http://www.dosemu.org/">DOSEMU</A>, and WINE
and used them a bit (DOSemu extensively). I've installed and
played with DOSemu (helped someone with it at an installfest a
couple weeks ago, too). However, I've never even tried WINE!
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, good luck on you're new release.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 1 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 1 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>Win4Lin eMERGEs</H3>
<p><strong>Answered By J. David Peet on Thu, 30 Mar 2000
</strong></p>
<BLOCKQUOTE>
Jim Dennis wrote:
</BLOCKQUOTE>
<!-- ::<BLOCKQuote>
Win4Lin eMERGEs
~~~~~~~~~~~~~~~
</BLOCKQuote>:: -->
<P><STRONG><FONT COLOR="#000066"><EM>
In case you did not know, the Win4Lin technology has a long
history as "Merge" for SCO Unix. SCO has been an OEM of
our Merge technology for years.
Win4Lin is the Linux version of the existing current technology.
</EM></FONT></STRONG></P>
<P><STRONG>
I didn't know that. I thought DOS/MERGE was from a
company called "Locus" or something like that.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Yes, I was there at Locus at the very start of Merge.
It's been a long path since then with some odd twists.
First Locus merged with Platinum, and Merge continued to
be developed, including the current SCO Merge 4 version
with win95 support. Then right before CA digested Platinum,
a company in Santa Cruz, DASCOM, bought (rescued!) the Merge
technology out from Platinum and hired some of us old-time Merge
developers to form a company named "TreLOS" to take the technology
forward including porting it to Linux. (Insert danger music here.)
Then before TreLOS could be spun off as it's own company, IBM bought
DASCOM, for reasons having nothing at all to do with Merge/TreLOS.
Then in February IBM finished spinning TreLOS off as it's own company.
We are currently a (very small) privately held company with NO
affiliation with IBM and NO IBM technology. (IBM for some reasons
wanted that to be clear.) Once we escaped from IBM it took a
bit more than a month to set up the infrastructure to be able to
release the product. It was getting caught up in the IBM acqusition
of DASCOM that prevented us from releasing the product last fall
as we had originally planned.
The Win4Lin 1.0 product has actually been ready for months now.
All that time was not completely wasted because IBM let us have an
extended semi-secret beta program so it's actually been in real use
for quite a while for a "1.0" version product.
</BLOCKQUOTE>
<BLOCKQUOTE>
So that's the history to this point. Perhaps more than you
wanted to know.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
...
Anyway, good luck on your new release.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
-Thanks
-David
</BLOCKQUOTE>
<BLOCKQUOTE>
P.S. Now that we are launching Win4Lin 1.0, having reviews done is
a Good Thing. So if you or Heather would like to do a review of it
that is extremely easy to arrange.
</BLOCKQUOTE>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/2"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 2 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Extracting a block of text from a file</H3>
<p><strong>From Tim Moss on Thu, 30 Mar 2000
</strong></p>
<P><STRONG>
I'm trying to extract a block of text from a file using just bash and
standard shell utilities (no perl, awk, sed, etc). I have a definitive
pattern that can denote the start and end or I can easily get the line
numbers that denote the start and end of the block of text I'm
interested in (which, by the way, I don't know ahead of time. I only
know where it is in the file). I can't find a utility or command that
will extract everything that falls between those points. Does such a
thing exist?
</STRONG></P>
<P><STRONG>
Thanks
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
awk and sed are considered to be "standard shell utilities."
(They are part of the POSIX specification).
</BLOCKQUOTE>
<BLOCKQUOTE>
The sed expression is simply:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
sed -n "$begin,${end}p" ...
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
... if begin and end are line numbers.
</BLOCKQUOTE>
<BLOCKQUOTE>
For patterns it's easier to use awk:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
awk "/$begin/,/$end/" ...
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
... Note: begin and end are regexes and should be
chosen carefully!
</BLOCKQUOTE>
<BLOCKQUOTE>
However, since you don't want to do it the
easy way, here are some alternatives:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
<TT>------------------</TT> WARNING: very long <TT>-------------------------</TT>
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
If it is a text file and you just want some lines out of
it try something like:
</BLOCKQUOTE>
<blockquote><pre> #!/bin/sh
# shextract.sh
# extract part of a file between a
# pair of globbing patterns
[ "$#" -eq "2" ] || {
echo "Must supply begin and end patterns" &gt;&amp;2
exit 1
}
begin=$1
end=$2
of="" ## output flag
while read a; do
case "$a" in
"$begin") of="true";;
"$end") of="";;
esac
[ -n "$of" ] &amp;&amp; echo $a
done
exit 0
</pre></blockquote>
<BLOCKQUOTE>
... this uses no external utilities except for the
test command ('[') and possibly the 'echo' command from
VERY old versions of Bourne sh. It should be supported
under any Bourne shell derivative. Under bash these
are builtin commands.
</BLOCKQUOTE>
<BLOCKQUOTE>
It takes two parameters. These are "globbing" patterns
NOT regular expressions. They should be quoted, especially
if they contain shell wildcards (?, *, and [...]
expressions).
</BLOCKQUOTE>
<BLOCKQUOTE>
Read any good shell programming reference (or even the
rather weak 'case...esac' section of the bash man page)
for details on the acceptable pattern syntax. Note
because of the way I'm using this you could invoke
this program (let's call it shextract, for "shell
extraction") like so:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
shextract "[bB]egin|[Ss]tart" "[Ee]nd|[Ss]top"
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
... to extract the lines between the any occurrence
of the term "begin" or "Begin" or "start" or "Start" and
the any subsequent occurence of "end" or "End" or "stop"
or "Stop."
</BLOCKQUOTE>
<BLOCKQUOTE>
Notice that I can use the (quoted) pipe symbol in this
context to show "alternation" (similar to the egrep use
of the same token).
</BLOCKQUOTE>
<BLOCKQUOTE>
This script could be easily modified to use regex's
instead of glob patterns (though we'd either have to
use 'grep' for that or rely on a much newer shell
such as ksh '93 or bash v. 2.x to do so).
</BLOCKQUOTE>
<BLOCKQUOTE>
This particular version will extract <EM>all</EM> regions
of the file that lie between our begin and end tokens.
</BLOCKQUOTE>
<BLOCKQUOTE>
To stop after the first we have to insert a "break"
statement into our "$end") ...;;; case. To support
an "nth" occurence of the pattern we'd have to use
an additional argument. To cope with degenerate
input (cases where the begin and end tokens might be
out of order, nested or overlapped) we'd have to
do considerably more work.
</BLOCKQUOTE>
<BLOCKQUOTE>
As written this example requires exactly two arguments.
It will only process input from stdin and only write
to stdout. We could easily add code to handle
more arguments (first two are patterns, 'shift'ed out
rest are input file names) and some options switches
(for output file, only one extraction per file,
emit errors if end pattern is found before start
pattern, emit warnings if no begin or subsequent end
pattern is found on any input file, stop processing on
any error/warning, etc).
</BLOCKQUOTE>
<BLOCKQUOTE>
Note: my exit 0 may seem superfluous here. However,
it does prevent the shell from noting that the
program "exited with non-zero return value" or
warnings to that effect. That's due to my use of
test ('[') on my output flag in my loop. In the
normal case that will have left a non-zero return value
since my of flag will be zero length for the part of
the file AFTER the end pattern was found.
</BLOCKQUOTE>
<BLOCKQUOTE>
Note: this program is SLOW. (That's what you get for
asking for it in sh). Running it on my 38,000 line
<TT>/usr/share/games/hangman-words</TT> (this laptop doesn't
have <TT>/usr/dict/words</TT>) it takes about 30 seconds or
roughly only 1000 lines per second on a P166 with 16Mb
of RAM. A binary can do better than that under MS-DOS
on a 4Mhz XT!
</BLOCKQUOTE>
<BLOCKQUOTE>
BUG: If any lines begin with <TT>-</TT> (dashes) then your version
of echo <EM>might</EM> try to treat the beginnings of your lines
as arguments. This <EM>might</EM> cause the echo command to
parse the rest of the line for escape sequences. If you
have printf(1) evailable (as a built-in to your shell or
as an external command) then you might want to use that
instead of echo.
</BLOCKQUOTE>
<BLOCKQUOTE>
To do this based on line numbers rather than patterns
we could use something more like:
</BLOCKQUOTE>
<blockquote><pre>#!/bin/sh
# lnextract.sh
# extract part of a file between a
# line numbers $1 and $2
function isnum () {
case "$1" in
*[^0-9]*)
return 1;;
esac
}
[ "$#" -gt "2" ] || {
echo "Must supply begin and end line numbers" &gt;&amp;2
exit 1
}
isnum "$1" || {
echo "first argument (first line) must be a whole number" &gt;&amp;2
exit 1
}
isnum "$2" || {
echo "second argument (last line) must be a whole number" &gt;&amp;2
exit 1
}
begin=$1
end=$2
[ "$begin" -le "$end" ] || {
echo "begin must be less than or equal to end" &gt;&amp;2
exit 1
}
shift 2
for i; do
[ -r "$i" -a -f "$i" ] || {
echo "$i should be an existing regular file" &gt;&amp;2
continue
}
ln=0
while read a ; do
let ln+=1
[ "$ln" -ge "$begin" ] &amp;&amp; echo $a
[ "$ln" -lt "$end" ] || break
done &lt; "$i"
done
exit 0
</pre></blockquote>
<BLOCKQUOTE>
This rather ugly little example does do quite a
bit more checking than my previous one.
</BLOCKQUOTE>
<BLOCKQUOTE>
It checks that its first two arguments are
numbers (your shell must support negated character
class globs for this, ksh '88 and later, bash 1.x and 2.x,
and zsh all qualify), and that the first is less than or
equal to the latter. Then it shifts those out of
the way so it can iterate over the rest of the
arguments, extracting our interval of line from
each. It checks that each file is "regular"
(not a directory, socket, or device node) and
readable before it tries to extract a portion of
it. It will follow symlinks.
</BLOCKQUOTE>
<BLOCKQUOTE>
It has some of the same limitations we saw before.
</BLOCKQUOTE>
<BLOCKQUOTE>
In addition it won't accept it's input from stdin
(although we could add that by putting the main loop
into a shell function and invoking it one way if
our arg count was exactly two, and differently
(within our for loop) if $# is greater than two.
I don't feel like doing that here <TT>---</TT> as this message
is already way too long and that example is complicated
enough.
</BLOCKQUOTE>
<BLOCKQUOTE>
It's also possible to use a combination of 'head' and
'tail' to do this. (That's a common exercise in
shell programming classes). You just use something
like:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
head -$end $file | tail -$(( $end - $begin ))
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
... note that the 'tail' command on many versions
of UNIX can't handle arbitrary offsets. It can
only handle the lines that fit into a fixed block size.
GNU tail is somewhat more robust (and correspondingly
larger and more complicated). A classic way to
work around limitations on tail was to use tac (cat
a file backwards, from last line to first) and
head (and tac again). This might use prodigous
amounts of memory or disk space (might use temporary
files).
</BLOCKQUOTE>
<BLOCKQUOTE>
If you don't want line oriented output <TT>---</TT> and your
patterns are regular expressions, and you're willing
to use grep and dd then here's a different approach:
</BLOCKQUOTE>
<blockquote><pre> start=$(grep -b "$begin" ... )
stop=$(( $( grep -b "$end" ... ) - $begin ))
dd if="$file" skip=$begin count=$stop bs=1b
</pre></blockquote>
<BLOCKQUOTE>
This is not a shell script, just an example.
Obviously you'd have to initialize $begin, $end, and $file
or use $1, $2, and $3 for them to make this into a
script. Also you have to modify those grep <TT>-b</TT> commands
a little bit (note my ellipses). This is because grep
will be giving us too much information. It will be
giving a byte offset to the beginning of each pattern
match, and it will be printing the matching line, too.
</BLOCKQUOTE>
<BLOCKQUOTE>
We can fix this with a little work. Let's assume that
we want the first occurrence of "$begin" and the last
occurence of "$end" Here's the commands that will
just give us the raw numbers:
</BLOCKQUOTE>
<blockquote><pre> grep -b "$begin" "$file" | head -1 {
IFS=:
read b x
echo b
}
grep -b "$end" "$file" | tail -1 | {
IFS=:
read e x
echo e
}
</pre></blockquote>
<BLOCKQUOTE>
... notice I just grep through head or
tail to get the first or last matching line,
and I use IFS to change my field separator
to a ":" (which grep uses to separate the offset
value from the rest of the line). I read the
line into two variables (separated by the
IFS character(s)), and throw away the extraneous
data by simply echoing the part I wanted
(the byte offset) back out of my subshell.
</BLOCKQUOTE>
<BLOCKQUOTE>
Note: whenever you use or see a pipe operator
in a shell command or script <TT>---</TT> you should
realize that you've created an implicit subshell
to handle that.
</BLOCKQUOTE>
<BLOCKQUOTE>
Incidentally, if your patterns <EM>might</EM> have a
leading <TT>-</TT> (dash) then you'll have problems
passing them to grep. You can massage the
pattern a little bit by wrapping the first
character with square brackets. Thus "foo"
becomes "[f]oo" and "<TT>-bar</TT>" becomes "[-]bar".
(grep won't consider an argument starting
with [ to be a command line switch, but it
will try to parse <TT>-bar</TT> as one).
</BLOCKQUOTE>
<BLOCKQUOTE>
This is easily done with printf and sed:
</BLOCKQUOTE>
<blockquote><pre> printf "%s" "$pattern" | sed -e 's/./[&amp;]/'
</pre></blockquote>
<BLOCKQUOTE>
... note my previous warning about 'echo' <TT>---</TT>
it's pretty permissive about arguments that
start with dashes that it doesn't recognize, it'll
just echo those without error. But if your pattern
starts with "<TT>-e</TT> " or <TT>-n</TT> it can effect out the rest
of the string is represented.
</BLOCKQUOTE>
<BLOCKQUOTE>
Note that GNU grep and echo DON'T seem to take the
<TT>--</TT> option that is included with some GNU utilities.
This would avoid the whole issue of leading dashes
since this conventionally marks the end of all
switch/option parsing for them.
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course you said you didn't want to use sed,
so you've made the job harder. Not impossible,
but harder. With newer shells like ksh '93 and
bash 2.x we can use something like:
</BLOCKQUOTE>
<blockquote><pre> [${pattern:0:1}]${pattern:1}
</pre></blockquote>
<BLOCKQUOTE>
(read any recent good book on shell programming
to learn about parameter expansion).
</BLOCKQUOTE>
<BLOCKQUOTE>
You can use the old 'cut' utility, or 'dd' to
get these substrings. Of course those are just
as external to the shell as perl, awk, sed,
test, expr and printf.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you really wanted to do this last sort of
thing (getting a specific size substring from
a variable's value, starting from an offset
in the string, using only the bash 1.x parameter
expansion primitives) it could be done with a whole
lot of fussing. I'd use ${#varname} to get the
size, a loop to build temporary strings of
? (question mark) characters to of the right
length and the ${foo#} and ${foo%} operators
(stripping patterns from the left and right of
variable's value respectively)
to isolate my substring.
</BLOCKQUOTE>
<BLOCKQUOTE>
Yuck! That really is as ugly as it sounds.
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway. I think I've said enough on the subject
for now.
</BLOCKQUOTE>
<BLOCKQUOTE>
I'm sure you can do what you need to. Alot of
it depends on which shell you're using (not just
csh vs. Bourne, but ksh '88 vs. '93 and bash v1.14
vs. 2.x, etc) and just how rigit you are about that
constraint about "standard utilities"
</BLOCKQUOTE>
<BLOCKQUOTE>
All of the examples here (except for the ${foo:}
parameter expansion) are compatible with bash 1.14.
</BLOCKQUOTE>
<BLOCKQUOTE>
(BTW: now that I'm really learning C <TT>---</TT> y'all can
either rest easy that I'll be laying off the sh
syntax for awhile, or lay awake in fear of what I'll
be writing about next month).
</BLOCKQUOTE>
<BLOCKQUOTE>
Here's a short GNU C program to print a set of
lines between one number and another:
</BLOCKQUOTE>
<blockquote><pre>/* extract a portion of a file from some beginning line, to
* some ending line
* this functions as a filter --- it doesn't take a list
* of file name arguments.
*/
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;errno.h&gt;
int
main (int argc, char * argv[] )
{
char * linestr;
long begin, end, current=0;
ssize_t * linelen;
linelen = 0;
linestr=NULL;
if ( argc &lt; 3 ) {
fprintf(stderr, "Usage: %s begin end\n", argv[0]);
exit(1);
}
begin=atol(argv[1]);
if ( begin &lt; 1 ) {
fprintf(stderr, "Argument error: %s should be a number "
"greater than zero\n", argv[1]);
exit(1);
}
end=atol(argv[2]);
if ( end &lt; begin ) {
fprintf(stderr, "Argument error: %s should be a number "
"greater than arg[1]\n", argv[1]);
exit(1);
}
while ( getline(&amp;linestr, &amp;linelen, stdin ) &gt; -1
&amp;&amp; (++current &lt; end ) ) {
if (current &gt;= begin) {
printf("%s", linestr);
}
}
exit(0);
return 0;
}
</pre></blockquote>
<BLOCKQUOTE>
This is about the same length as my shell version.
It uses<TT> atol()</TT> rather than<TT> strtol()</TT> for the
argument to number conversion.<TT> atol()</TT> (ASCII to long)
is simpler, but can't convey errors back to us.
However, I require values greater than zero, and GNU
glibc<TT> atol()</TT> returns 0 for strings that can't be
converted to longs. I also use the GNU<TT> getline()</TT>
function <TT>---</TT> which is non-standard, but much more
convenient and robust than fussing with<TT> scanf()</TT>,
<TT>fgets()</TT> and<TT> sscanf()</TT>, and<TT> getc()</TT> stuff.
</BLOCKQUOTE>
<BLOCKQUOTE>
Tim, I've copied this my Linux Gazette editor, since
it's a pretty general question and a way detailed
answer. Unless you have any objection it will
go into my column in the next issue. The sender's
e-mail address and organizational affiliation are
always removed from answer guy articles unless
they request otherwise.
</BLOCKQUOTE>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/3"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 3 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Zipping Across the LAN</H3>
<p><strong>From jashby on Sun, 02 Apr 2000
</strong></p>
<!-- ::
Zipping Across the LAN
~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hello ,
</STRONG></P>
<P><STRONG>
My name is Jason Ashby i work for a computer company and am really new
to Linux i have been given the task to make a zip drive visible accross
a network, it is loaded on a linux machine and i can get the AIX machine
to mount it but we can not copy files to or from the zip drive on AIX
could you see it within your power to tell me why .
</STRONG></P>
<P><STRONG>
Thanks
Jason Ashby
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Unfortunately your question is unclear.
You don't tell me which system is supposed to be the server, what
sorts systems are intended to be the clients, nor what type of
filesystems will be contained on the Zip media.
</BLOCKQUOTE>
<BLOCKQUOTE>
"make a zip drive visible accross [sic] a network"
</BLOCKQUOTE>
<BLOCKQUOTE>
... presumably you mean via NFS or Samba. If the client systems
are UNIX or Linux you'd use NFS, if they are MS-Windows or OS/2
you'd use Samba. (If they were Apple Macs running MacOS you'd
look at the netatalk or CAP packages, and if they were old MS-DOS
machines you might try installing Netware client drivers on those
and mars_nwe or a commercial copy of Netware on the Linux box).
</BLOCKQUOTE>
<BLOCKQUOTE>
Let's assume you mean to mount the Zip disks on your Linux box,
and "export" them (NFS terminology) to your AIX systems. Then
you'd modify your <TT>/etc/fstab</TT> to contain an entry appropriate to
mount the Zip media into your file hierarchy. Maybe you'd mount
it under <TT>/mnt/zip</TT> or under <TT>/zip.</TT> (You might have multiple fstab
entries to support different filesystems that you might have
stored on your Zip media. In most cases you'd use msdos, or one
of the other variants of Linux' MS-DOS filesystem: umsdos, vfat,
or uvfat).
</BLOCKQUOTE>
<BLOCKQUOTE>
Then you'd edit your <TT>/etc/exports</TT> file to export that to your
LAN (or to specific hosts or IP address/network patterns).
</BLOCKQUOTE>
<BLOCKQUOTE>
Try reading the man pages for <TT>/etc/fstab</TT> and <TT>/etc/exports</TT> and
perusing the following HOWTOs:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Zip Drive Mini-HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/mini/ZIP-Drive.html"
>http://www.linuxdoc.org/HOWTO/mini/ZIP-Drive.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
NFS HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/NFS-HOWTO.html"
>http://www.linuxdoc.org/HOWTO/NFS-HOWTO.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
And the excellent new:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Filesystems HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Filesystems-HOWTO.html"
>http://www.linuxdoc.org/HOWTO/Filesystems-HOWTO.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
by Martin Hinner.
</BLOCKQUOTE>
<BLOCKQUOTE>
If that doesn't do the trick, try clarifying your question. It
often helps to draw a little map (ASCII art is good!).
</BLOCKQUOTE>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/4"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 4 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Accessing Local MS-DOS/Windows '9x Drives/Disks from Linux</H3>
<p><strong>From David Buckley on Wed, 05 Apr 2000
</strong></p>
<!-- ::
Accessing Local MS-DOS/Windows '9x Drives/Disks from Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
I am new to linux and am wondering if there is an easy way to access my
Win98 disk from within linux. i have lots of files (mp3s, etc.) that i
would like to use in linux. what is the easiest way to get them?
</STRONG></P>
<P><STRONG>
Thanks,
David Buckley
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I'm guessing you're talking about accessing files that are on
you local system (that you have a dual-boot installation).
</BLOCKQUOTE>
<BLOCKQUOTE>
In that case use the 'mount' command. For example the first
partition on your first IDE drive is <TT>/dev/hda1</TT> (under Linux). If
that's your C: drive under MS-DOS/Windows then you can use a
command like:
</BLOCKQUOTE>
<blockquote><pre> mkdir /mnt/c &amp;&amp; mount -t vfat /dev/hda1 /mnt/c
</pre></blockquote>
<BLOCKQUOTE>
... (as the 'root' user) to make the C: directory tree appear
under <TT>/mnt/c.</TT>
</BLOCKQUOTE>
<BLOCKQUOTE>
Once you've done that you can use normal Linux commands and
programs to access those files.
</BLOCKQUOTE>
<BLOCKQUOTE>
That will only mount the filesystem for that duration of that
session (until your reboot or unmount it with the 'umount'
command). However, you can make this process automatic by adding
an entry to your <TT>/etc/fstab</TT> (filesystem table).
</BLOCKQUOTE>
<BLOCKQUOTE>
For more info on this read the appropriate sections of the Linux
Installation &amp; Getting Started Guide (*), the System
Administrator's Guide (*) (both part of the <A HREF="http://www.linuxdoc.org/">LDP</A> at
<A HREF="http://www.linuxdoc.org"
>http://www.linuxdoc.org</A>) and the mount(8), and fstab(5) man pages
with the following command:
</BLOCKQUOTE>
<blockquote><pre> man 8 mount; man 5 fstab
</pre></blockquote>
<BLOCKQUOTE>
(Note, in the first case you do need to specify the
manual chapter/section number, 8, since there is a<TT> mount()</TT>
system call which is used by programmers, particularly for
writing programs like the 'mount' command itself). When you
see references to keywords in this form foo(1), it's a hint
that foo is documented in that chapter of the man pages: 1
is user commands, 2 is system calls, 3 is library functions,
4 is for devices, 5 is for file formats, etc).
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
*( LIGS: Chapter 4 System Administration
<DD><A HREF="http://www.linuxdoc.org/LDP/gs/node6.html#SECTION00640000000000000000"
>http://www.linuxdoc.org/LDP/gs/node6.html#SECTION00640000000000000000</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
LSAG: Filesystems
<A HREF="http://www.linuxdoc.org/LDP/sag/x1038.html"
>http://www.linuxdoc.org/LDP/sag/x1038.html</A> )
</BLOCKQUOTE>
<BLOCKQUOTE>
To access your MS-DOS formatted floppies it's often easier to use
the mtools commands. Look at the mtools(1) man pages for details
on that.
</BLOCKQUOTE>
<BLOCKQUOTE>
Here are a couple of other HOWTOs to read through:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
From DOS/Windows to Linux HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/DOS-Win-to-Linux-HOWTO.html"
>http://www.linuxdoc.org/HOWTO/DOS-Win-to-Linux-HOWTO.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Filesystems HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Filesystems-HOWTO.html"
>http://www.linuxdoc.org/HOWTO/Filesystems-HOWTO.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
In general you want to look through these to find answer to
most common Linux questions. As you might imagine, you've asked
a very common one here). In fact it's number 4.2 in the FAQ
<A HREF="http://www.linuxdoc.org/FAQ/Linux-FAQ-4.html#ss4.2"
>http://www.linuxdoc.org/FAQ/Linux-FAQ-4.html#ss4.2</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
You can also search the Linux Gazette at:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Full search on archive Linux Gazette Search
<DD><A HREF="http://www.linuxgazette.com/search.html"
>http://www.linuxgazette.com/search.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
Although I can see how you might not know what terms to search on
until you've covered some of the basics in the LDP guides, or any
good book on Linux.
</BLOCKQUOTE>
<BLOCKQUOTE>
There are also ways to access your Win '9x "shares" (network
accessible files, or "exported" directories) from Linux using
smbfs.
</BLOCKQUOTE>
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/5"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 5 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>More on &gt;&gt; zsh Co-processes</H3>
<p><strong>From Paul Ackersviller on Wed, 05 Apr 2000
</strong></p>
<!-- ::
More on &gt;&gt; zsh Co-processes
~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Jim,
</STRONG></P>
<P><STRONG>
I believe I forgot to say thanks for having written the original answer as
it was. I've programmed shells for ages, but have never had occasion to use
co-processes. Seeing examples of how it's done are alway a good thing.
</STRONG></P>
<P><STRONG>
--
Paul Ackersviller
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
You're welcome. I've never actually used them myself.
However, I was jazzed to learn how they actually work when
someone I was working with showed me an example.
</BLOCKQUOTE>
<BLOCKQUOTE>
Sometimes I take advantage of being "The Answer Guy" and
grab any pretense to show of some need trick that I've
discovered or been shown (I usually try to give credit
where credit is due <TT>---</TT> but sometimes that's pretty ambiguous and
doesn't fit into the flow of what I'm typing).
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, I'm a firm believer in having a full toolbox. You
often won't know what tool <EM>would</EM> do the trick unless you've
seen a wide enough variety of tools to recognize a nail vs.
a screw and can associate one with a hammer and the other with
a screwdriver.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 5 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/6"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 6 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Linux for AMD, Cyrix, etc</H3>
<p><strong>From Ranone7 on Wed, 05 Apr 2000
</strong></p>
<!-- ::
Linux for AMD, Cyrix, etc
~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
At this web site <A HREF="http://www.linuxmall.com/product/01462.html"
>http://www.linuxmall.com/product/01462.html</A> I see
the title "<A HREF="http://www.redhat.com/">Red Hat</A> Linux Deluxe for Intel" Is there a Linux for
AMD out there? or can I use the above linux version with an
AMD-Athlon.
</STRONG></P>
<P><STRONG>
Thank you
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The packaging is suffering from a compromise. It's trying
not to sound too technical. Red Hat Linux <EM>for Intel</EM>
should work on any x86 and compatible CPUs. Note that
Mandrake requires at least a Pentium (it won't work on
old 486 and 386 systems).
</BLOCKQUOTE>
<BLOCKQUOTE>
What Red Hat Inc was trying to do which this verbiage
is distiguish that box from the versions that they have
available for SPARC and Alpha based systems. Eventually they'll
also probably have a PowerPC package available as well.
</BLOCKQUOTE>
<BLOCKQUOTE>
Many other distributions are similarly available on several
platforms.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 6 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 6 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>Linux - AMD?</H3>
<p><strong>Answered By Martin Pool on Thu, 06 Apr 2000
</strong></p>
<P><STRONG>
On Wed, 5 Apr 2000, Jim Dennis wrote:
</STRONG></P>
<P><STRONG><FONT COLOR="#000099"><EM><BLOCKQuote>
<BR>&gt;At this web site <A HREF="http://www.linuxmall.com/product/01462.html"
<BR>&gt; >http://www.linuxmall.com/product/01462.html</A> I see
<BR>&gt;the title "<A HREF="http://www.redhat.com/">Red Hat</A> Linux Deluxe for Intel" Is there a Linux for
<BR>&gt;AMD out there? or can I use the above linux version with an
<BR>&gt;AMD-Athlon.
</BLOCKQuote></EM></FONT></STRONG></P>
<P><STRONG><FONT COLOR="#000099"><EM>
<BR>&gt;Thank you
</EM></FONT></STRONG></P>
<P><STRONG><FONT COLOR="#000066"><EM>
The packaging is suffering from a compromise. It's trying
not to sound too technical. Red Hat Linux <EM>for Intel</EM>
should work on any x86 and compatible CPUs. Note that
Mandrake requires at least a Pentium (it won't work on
old 486 and 386 systems).
</EM></FONT></STRONG></P>
<P><STRONG>
Good explanation. IIRC Athlons are only supported in 2.2.something, so
they'll also need a recent distribution. I guess any RedHat version on
sale these days will be OK, but notably <A HREF="http://www.debian.org/">Debian</A> slink/stable will <EM>not</EM>
boot.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Thanks for that note [from one of the guys on the
<A HREF="http://www.linuxcare.com/">Linuxcare</A> list that now receives answerguy responses].
</BLOCKQUOTE>
<BLOCKQUOTE>
I remember hearing about Athlon problems, but I didn't ever get the
full story. I was spoiled by the fact that most x86 compatible
chips really are <EM>x86 COMPATIBLE</EM>. I still don't know what the
whole deal with that Athlon chip is. I'll BCC someone on this
to see if he can clue me in.
</BLOCKQUOTE>
<!-- end 6 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 6 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>Linux - AMD?</H3>
<p><strong>Answered By David Benfell on Thu, 6 Apr 2000
</strong></p>
<BLOCKQUOTE>
The story, as I was able to piece it together, is that the problem was
found and fixed in the 2.3.19 kernel. The correction had to do with
Memory Type Range Register (MTRR) code. This patch was backported to,
possibly the 2.2.12 kernel, and, almost certainly, the 2.2.13 kernel.
</BLOCKQUOTE>
<BLOCKQUOTE>
However, it still seems to have been an issue with the Mandrake 6.5
distribution, which had a 2.2.12 kernel. On the other hand, my
neighbor just installed <A HREF="http://www.redhat.com/">Red Hat</A> 6.2, with, I think, a 2.2.12 kernel
(but the site won't tell), on an Athlon. So I'm confused.
</BLOCKQUOTE>
<BLOCKQUOTE>
David Benfell
</BLOCKQUOTE>
<EM>[ <BLOCKQUOTE>
So, if you know more about the Athlon MTRR mystery, enlighten us please!
</BLOCKQUOTE><P>-- Heather. ]</P></EM>
<!-- end 6 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/7"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 7 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>UNIX User Tries Linux 'rsh'</H3>
<p><strong>From Le, Dong, ALNTK on Fri, 07 Apr 2000
</strong></p>
<!-- ::
UNIX User Tries Linux 'rsh'
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hello "The Answer Guy",
</STRONG></P>
<P><STRONG>
My name is Dong Le. I'm quite new to Linux. Since I come from Unix world, I
try to use Unix concepts to apply on Linux. Some times it works, most of the
time does not.
</STRONG></P>
<P><STRONG>
Anyway, I have Redhat 6.1 installed on my 2 PC intel-based. I tried to use
rcp to remote copy files from one PC to another. I got the error:
"permission denied" from other PC. I have a file ".rhosts" setup to give
permission to other PC. I use "octet format" in all of files/commands so
DNS/NIS are not involved at all.
</STRONG></P>
<P><STRONG>
My questions are:
</STRONG></P>
<P><STRONG><BLOCKQuote>
<TT>-</TT> Why do I have this error?
</BLOCKQuote></STRONG></P>
<P><STRONG>
<TT>-</TT> Later on I found out that Linux is using PAM to do authentication. For
rcp, it is using <TT>/etc/pam.d/rsh.conf</TT> to authenticate. However, I can not
find any information about PAM modules (pam_rhosts_auth.so, for example)
regarding how it works. Do you know where I can obtain information about
particular PAM module?
</STRONG></P>
<P><STRONG>
Thanks a lot,
Dong Le,
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Short answer: Use ssh!
</BLOCKQUOTE>
<BLOCKQUOTE>
There are a few problems here. First, I've seen versions of rshd
(the rsh daemon) that would not seem to accept octet addresses.
More importantly many Linux distributions are configured not to
respect your ~/.rhosts files.
</BLOCKQUOTE>
<BLOCKQUOTE>
You are correct that you have to co-ordinate your policy using the
PAM if your system has the "Pluggable Authentication Modules"
suite of programs installed. The configuration file would be
<TT>/etc/pam.d/rsh.</TT> Here's the default that would be installed by
<A HREF="http://www.debian.org/">Debian</A>:
</BLOCKQUOTE>
<blockquote><pre>#%PAM-1.0
auth required pam_rhosts_auth.so
auth required pam_nologin.so
auth required pam_env.so
account required pam_unix_acct.so
session required pam_unix_session.so
</pre></blockquote>
<BLOCKQUOTE>
Yours would be pretty similar.
</BLOCKQUOTE>
<BLOCKQUOTE>
In addition you might find that you need to also modify the
arguments on the in.rshd line in your <TT>/etc/inetd.conf</TT> file. For
example if there's a <TT>-l</TT> option it may be causing your copy of
in.rshd to ignore user ~/.rhosts files. A <TT>-h</TT> option will force it
to ignore the contents of any <TT>/etc/hosts.equiv</TT> file.
</BLOCKQUOTE>
<BLOCKQUOTE>
(The new Debian rshd package ignores these additional options and
requires that you configure your policy through the <TT>/etc/pam.d/</TT>
files. I don't know if <A HREF="http://www.redhat.com/">Red Hat</A> has modified it's packages in this
way for versions 6.1 or 6.2. In 6.0 I'm pretty sure that I was
still able to use the command line arguments on the in.rshd entry
in the <TT>/etc/inet.conf</TT> file for this.)
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course you can use ssh as a resplacement to rsh, and have
much better security as well.
</BLOCKQUOTE>
<!-- end 7 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/8"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 8 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Telnet</H3>
<p><strong>From Cleary, James R. on Fri, 07 Apr 2000
</strong></p>
<P><STRONG>
Jim,
</STRONG></P>
<P><STRONG>
I just clean installed Redhat 6.0 on my box. I can ping the
</STRONG></P>
<P><STRONG>
box from another machine, but I can't telnet to it, the default
configuration should provide for that, shouldn't it? Any help
you'd have would be great.
</STRONG></P>
<P><STRONG>
Sincerely,
"J.C."
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
When you say "you can't telnet to it" what do you mean?
Does the telnet client seem to just sit there for a long time? Do
you get an error message that says something like "connection
refused?" Does that come back immediately, or does it take a
minute or two? Are you trying to telnet to it by name, or by IP
address? (That basically doesn't matter as long as you're using
the same form for your ping command).
</BLOCKQUOTE>
<BLOCKQUOTE>
I disagree with your assertion that the "default configuration
should provide for that?" Linux appeals to a much broader range
of users than traditional, professionally managed UNIX systems.
It is not appropriate to assume that all of your users what to be
"telnet hosts" (servers or multi-user workstations). In addtional
telnet is an old and basically depracated means of remote access.
</BLOCKQUOTE>
<BLOCKQUOTE>
(Well, it should be deprecated).
</BLOCKQUOTE>
<BLOCKQUOTE>
You should probably use ssh, STEL, ssltelnet, or install a
Kerberos or the <A HREF="http://www.xs4all.nl/~freeswan/">FreeS/WAN</A> IPSec infrastructure to provide you with
an encrypted, unspoofable, unsniffable connection between your
client and your server.
</BLOCKQUOTE>
<BLOCKQUOTE>
Please don't respond with "but I'm behind a firewall" or "this is
just my home system." Those are "head in the sand" attitudes that
make for a brittle infrastructure (one little crack and the whole
wall collapses).
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, if you've termined that telnet is really what you need,
that it matches your requirements and enforces your policies to
your satisfaction, then here's some pointer to troubleshooting
common failures. These also apply to ssh, STEL, etc.
</BLOCKQUOTE>
<BLOCKQUOTE>
You said that 'ping' is working. Assuming that you are using the
commands from the same host and using the same form of
addressing/naming for your 'ping' and your 'telnet' commands here
are the most likely problems:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
* You're session might not actually be failing. It might
just be taking a very long time. Search the answer guy
back issues for the phrase "double;reverse;dns" and you'll
find a number of my previous explanations about a common
cause of this delay (and some pointer on what to do about it)
Here are a couple of them:
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Issue 45: More "Can't Telnet Around My LAN" Problems
<DD><A HREF="http://www.linuxgazette.com/issue45/tag/11.html"
>http://www.linuxgazette.com/issue45/tag/11.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Issue 38: Telnetd and pausing
<DD><A HREF="http://www.linuxgazette.com/issue38/tag/32.html"
>http://www.linuxgazette.com/issue38/tag/32.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Issue 30: tv cards and dual monitor
<DD><A HREF="http://www.linuxgazette.com/issue30/tag_tvcard.html"
>http://www.linuxgazette.com/issue30/tag_tvcard.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
* You might not have the telnet daemon package installed
</BLOCKQUOTE>
<BLOCKQUOTE>
on your target host. It might be installed but not
properly configured in <TT>/etc/inetd.conf.</TT> That should
contain a line that looks something like:
</BLOCKQUOTE>
<blockquote><pre>telnet stream tcp nowait telnetd.telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
</pre></blockquote>
<BLOCKQUOTE>
* You might not have inetd running. (It's the daemon, service
</BLOCKQUOTE>
<BLOCKQUOTE>
program, that reads the <TT>/etc/inetd.conf</TT>, listens for
connections on those ports, and dispatches the various
service programs that handle those services).
</BLOCKQUOTE>
<BLOCKQUOTE>
(An obscure possibility is that you might have something
broken in your name services handling. You system would
normally match service/protocol names to IP port numbers
and transport layer protocols (TCP, UDP, etc) using the
<TT>/etc/services</TT> file. If that's corrupted, or if your
<TT>/etc/nsswitch.conf</TT> is pointing your NSS libraries to
query some really bogus and corrupted backend it would be
possible that inetd would end up listening to the wrong
ports for many services. I've never seen anyone mess
that up <TT>--</TT> but I'm sure it's possible).
</BLOCKQUOTE>
<BLOCKQUOTE>
* There may be a firewall or packet filtering system between
</BLOCKQUOTE>
<BLOCKQUOTE>
your client and your target. That might let ICMP ('ping'
traffic) through while blocking your TCP ('telnet' on port
23) traffic.
</BLOCKQUOTE>
<BLOCKQUOTE>
* It's possible that you're telnet client program, or one
</BLOCKQUOTE>
<BLOCKQUOTE>
of the client libraries is broken, or that you have some
degenerate values in your environment or even in your
own .telnetrc file. The 'telnet' client exchanges a
number of key environment variables with the daemon
to which it connects. This is to configure your terminal
type, set your username and your DISPLAY values, your
timezone, and some other stuff. It's possibly (though
unlikely) that you could be tripping over something that
the 'in.telnetd' on your target really doesn't like).
</BLOCKQUOTE>
<BLOCKQUOTE>
Hopefully that will help.
</BLOCKQUOTE>
<BLOCKQUOTE>
When asking about these sorts of problems it's important to
be quite specific about the failure mode (the symptoms). It is
VERY important to capture and quote any error messages that you
get and to explain exactly what command(s) you issued to elicit
those symptoms.
</BLOCKQUOTE>
<BLOCKQUOTE>
Unfortunately crafting a good question is sometimes harder than
answering them. (In fact I have managed to come across answer
on many occasions while I was writing up the question I intended
to post. The process or rigorously describing the problem has
often led me to my own answers. Sometimes I post the message
with my solution anyway).
</BLOCKQUOTE>
<BLOCKQUOTE>
One tip for troubleshooting this. Staring with 'ping' is a good
idea. It basically eliminates a number of possible problems
from the low-level "is the network card configured and is a
cable plugged into it?" parts of your problem. It's also good
to do a 'traceroute' to your target. This might show that your
packets are being routed through some unexpected device that is
filtering some of your traffic.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you have console access to the target server (including a "carbon
proxy" <TT>---</TT> a person on the phone in front of it) then you can
run (or have your proxy) run the 'tcpdump' command. This can
show you the headers of every packet that comes across a given
network interface. 'tcpdump' has a small language for describing
the exact sorts of traffic that you want to see and filtering out
all the other traffic that you don't want. If you search the
LG AG archives on 'tcpdump' you should find a number of examples
of how to use it. You might go for something like:
</BLOCKQUOTE>
<blockquote><pre> tcpdump -i eth0 -n host $YOURCLIENT and port 23
</pre></blockquote>
<BLOCKQUOTE>
... for example. (TCP port 23 is the standard for telnet traffic).
</BLOCKQUOTE>
<BLOCKQUOTE>
If that doesn't work, you might consider temporarily replacing your
'in.telnetd' with an 'strace' wrapper script. Basically
you just rename the in.telnetd file to in.telnetd.real and
create a shell script (see below) to monitor it:
</BLOCKQUOTE>
<blockquote><pre>#!/bin/sh
exec strace -o /root/testing/telnet.strace /usr/sbin/in.telnetd.real
</pre></blockquote>
<BLOCKQUOTE>
I've described this process before as well. Here's a
link to one of those:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Issue 20
<DD><A HREF="http://www.linuxgazette.com/issue20/lg_answer20.html"
>http://www.linuxgazette.com/issue20/lg_answer20.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Issue 17
<DD><A HREF="http://www.linuxgazette.com/issue17/answer.html"
>http://www.linuxgazette.com/issue17/answer.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
(use your browswer's "search in page" <TT>--</TT> [Alt][F] in Netscape
and the <TT>/</TT> key in Lynx to search on 'strace' to find the
messages I'm talking about. Those older issues were back before
Heather was doing my HTML for me, and splitting each message/thread
into separately HTML pages like I should have been doing all
along).
</BLOCKQUOTE>
<BLOCKQUOTE>
That 'strace' trick is surprising handy. At <A HREF="http://www.linuxcare.com/">Linuxcare</A> we use
it all the time, and it often helps us find missing config files,
directories where files should be, files where directories should
be, mangled permissions, and all sorts of things. There's another
tools called 'ltrace' which gives similar, though slightly higher
level information.
</BLOCKQUOTE>
<BLOCKQUOTE>
Using 'tcpdump' and 'strace' you can troubleshoot almost any
problem in Linux. They are like the "X-Ray" machines and CAT/PET
scanners for Linux tech support people. However, I don't recommend
them lightly. Go through the list of common ailments that I listed
first, consider using ssh instead, and then see if you need
"surgical diagnostics."
</BLOCKQUOTE>
<!-- end 8 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/9"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 9 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Getting Familiar with a UNIX System</H3>
<p><strong>From Patricia Lonergan on Fri, 07 Apr 2000
</strong></p>
<!-- ::
Getting Familiar with a UNIX System
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
How would I find the following on the version of Unix I am using:,A (B OS
type and release, node name, IP address, CPU type, CPU speed, amount of
RAM, disk storage space, number of users who have ids, number of hosts
known.,A (B Thanks Answer Guy
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The comamnd:
</BLOCKQUOTE>
<blockquote><pre> uname -a
</pre></blockquote>
<BLOCKQUOTE>
Should give you the UNIX name (Linux, SunOS, HP-UX, etc)
and the kernel version/release, architecture, and some other info.
(Might also include the kernel compilation date and host)
</BLOCKQUOTE>
<BLOCKQUOTE>
The command:
</BLOCKQUOTE>
<blockquote><pre> ifconfig -a
</pre></blockquote>
<BLOCKQUOTE>
... should give the the IP address, netmask and broadcast address of
each interface in the system.
</BLOCKQUOTE>
<BLOCKQUOTE>
The command:
</BLOCKQUOTE>
<blockquote><pre> hostname
</pre></blockquote>
<BLOCKQUOTE>
... should give you the the DNS hostname that this system
"thinks" it has. Looking that up via reverse DNS using a
command like:
</BLOCKQUOTE>
<blockquote><pre> dig -x
</pre></blockquote>
<BLOCKQUOTE>
... might be possible if you have the DNS utils package
installed.
</BLOCKQUOTE>
<BLOCKQUOTE>
From there things start to get pretty complicated depending
on which flavor of UNIX you're on, and how it's configured.
(In fact there are exceptional cases where the preceding
commands won't work):
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
I'll confine the rest of my answers to Linux.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
You can get the CPU type and speed using the command:
</BLOCKQUOTE>
<blockquote><pre> cat /proc/cpuinfo
</pre></blockquote>
<BLOCKQUOTE>
(assuming that your kernel is compiled with the <TT>/proc</TT> filesystem
enabled and that you have <TT>/proc</TT> mounted. Those are the
common case).
</BLOCKQUOTE>
<BLOCKQUOTE>
Linux provides a 'free' command to report on your RAM and
swap availability and usage. Many UNIX systems will have the
'top' command installed. It can also provide that information
(though it defaults to interactive mode <TT>---</TT> and thus is less
useful in scripts).
</BLOCKQUOTE>
<BLOCKQUOTE>
Any UNIX system should provide the 'mount' and 'df' commands to
generate reports about what storage devices are attached and
in use (mounted) and about the amound of free space available on
each. Note you should track not only your free space (data blocks)
but your free inodes (management data) so use both of the following
commands:
</BLOCKQUOTE>
<blockquote><pre> df
df -i
</pre></blockquote>
<BLOCKQUOTE>
The 'mount' command will also report the filesystem types and any
options (readonly, synchronous, etc) that are in effect on these.
You might have to use the 'fdisk <TT>-l</TT>' command to find any
unmounted filesystems (that might not be listed in your <TT>/etc/fstab</TT>
file) under Linux. Solaris has a similar command called prvtoc
(print volume table of contents).
</BLOCKQUOTE>
<BLOCKQUOTE>
Asking about number of user accounts is straightforward on a
system that is just using local <TT>/etc/passwd</TT> and <TT>/etc/group</TT> files
(the default). You can simply using the following:
</BLOCKQUOTE>
<blockquote><pre> wc -l /etc/passwd
</pre></blockquote>
<BLOCKQUOTE>
... to get a number of local users. Note that many of these
accounts are purely system accounts, used to managed the
ownership and permissions on files and system directories.
If you read though that file a little bit it should be obvious
which ones are which. In general Linux distributions start
numbering "real" users (the ones added after the system was
installed) at 500 or 1000 so all of the names with a UID
above that number are "real" (or were added by the system
administrator).
</BLOCKQUOTE>
<BLOCKQUOTE>
However, it's possible (particularly in UNIX system that are
installed on corporate networks) that your system(s) are using
a networked account system such as NIS or NIS+. You might be
able to get some idea of the number of users on such a network
using the 'ypcat' command like so:
</BLOCKQUOTE>
<blockquote><pre> ypcat passwd | wc -l
</pre></blockquote>
<BLOCKQUOTE>
The questions of "number of hosts known" is actually a bit
silly. "Known" in what sense? Most system use DNS for
mapping host names to IP addresses. Thus any Internet connected
system "knows" about millions of hosts. It is possible for
a sysadmin to provide the system with a special list of hosts and
IP addresses using the <TT>/etc/hosts</TT> files, but this is pretty rare
these days. (It's just too likely that you'll get those files
out of sync with your DNS).
</BLOCKQUOTE>
<BLOCKQUOTE>
I suppose you should also look for commands with the letters
"stat" in their name. Read the man pages for 'vmstat', 'netstat'
'lpstat' etc. Many versions of UNIX also include a 'sar' command
though that isn't common on Linux. 'rpcinfo' and 'route'
are other useful commands.
</BLOCKQUOTE>
<BLOCKQUOTE>
This whole set of questions has a "do my homework" tone to it.
(particularly since it's common from a .edu domain). Keep
in mind that I've just barely scratched the surface of the
information that's available to a skilled sysadmin who needs to
become familiar with a new machine. There are hundreds of
other things to know about such a system.
</BLOCKQUOTE>
<BLOCKQUOTE>
Most of the information you care about it under <TT>/etc.</TT> On a
Linux system there is also quite a bit under <TT>/proc</TT> (most of
forms of UNIX that support <TT>/proc</TT> only but process information
thereunder, while the Linux kernel uses it as an abstraction to
provide for all sorts of dynamic kernel status information out to
user space).
</BLOCKQUOTE>
<!-- sig -->
<!-- end 9 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/10"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 10 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Connecting NT and OS/2</H3>
<p><strong>From Carlos Ferrer on Thu, 13 Apr 2000
</strong></p>
<!-- ::
Connecting NT and OS/2
~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Do you know how to connect an NT box with an OS/2 box using null modem?
</STRONG></P>
<P><STRONG>
Thanks,
Carlos Ferrer
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Yes. You plug one end of the null modem cable into a serial
port on one of the boxes, and the other into a serial port on the
other box. Then you install some software on each, configure and
run it.
</BLOCKQUOTE>
<BLOCKQUOTE>
Before you ask:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
NO! I don't know what NT or OS/2 native software you should use.
That's your problem. I answer Linux questions. I'm the Linux Gazette
Answer Guy.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
So, why don't you ask the technical support from IBM and/or Microsoft.
They sold you the software. They should provide the support. The
Linux community gives us software, so I give away alot of support.
</BLOCKQUOTE>
<BLOCKQUOTE>
Meanwhile, you might have some luck with plain old MS-DOS Kermit.
NT and OS/2 are supposed to support running DOS programs, and they
should allow you to configure their DOS "boxes" (virtual machines,
whatever) to have access to their respective serial ports. You can
also get Kermit '95 which should work on Win '9x, NT, and OS/2.
This is a commercial package. It is not free.
</BLOCKQUOTE>
<BLOCKQUOTE>
The C-Kermit for UNIX and Linux is also not free; though it can be
freely downloaded and compiled. You should read its license to
determine if you can use it freely or whether you are required to
buy the C-Kermit book. (Of course you could support their project
by buying the books regardless). There is also a G-Kermit which is
GPL'd.
</BLOCKQUOTE>
<BLOCKQUOTE>
You can learn about Kermit at:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Columbia University Kermit Project Home page
<DD><A HREF="http://www.columbia.edu/kermit"
>http://www.columbia.edu/kermit</A>
</DL></BLOCKQUOTE>
<!-- sig -->
<!-- end 10 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/11"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 11 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>"Temporarily Controlling a VT"</H3>
<p><strong>From James Knight on Thu, 13 Apr 2000
</strong></p>
<!-- ::
"Temporarily Controlling a VT"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
If I have an interactive program running on a VT, say tty1, can i
temporarily "control" that VT from another, say tty2, or better yet,
through a telnet connection (pts/n)?
</STRONG></P>
<P><STRONG>
For instance, i have naim running on tty1, I've been logging in via
telnet, and killing that process, and start it again so they don't
interfere with each other. Can I just pretend I'm at the console somehow,
then when I logout, i'll still be connected to naim?
</STRONG></P>
<P><STRONG>
Thanks,
Jay Knight
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The easiest way to do this is to run 'screen'
</BLOCKQUOTE>
<BLOCKQUOTE>
Instead of starting interactive programs directly from your VT
login shell, run 'screen' and start the program thereunder. Now
you can "detach" the whole screen session (with up to 10 interactive
programs running under it) and re-attach from any other sort of
terminal login.
</BLOCKQUOTE>
<BLOCKQUOTE>
I do this routinely. I'm doing it now. Currently I'm working in
an xterm which is 99 characters wide and 35 lines tall. Earlier
I had connected to my system via ssh, and I "yanked" my 'screen'
session over to that xterm (80 characters by 50 lines) using the
following command:
</BLOCKQUOTE>
<blockquote><pre> 'screen -r -d -e^]]'
</pre></blockquote>
<BLOCKQUOTE>
... the <TT>-d</TT> option tells my new 'screen' command to look for another
'screen' session and detach it from wherever it is, the <TT>-r</TT> is to
re-attach it to my current terminal or psuedo-terminal, and the
<TT>-e</TT> option let's me set alternative "escape" and "quote" characters
(more on that in a moment).
</BLOCKQUOTE>
<BLOCKQUOTE>
I've described 'screen' in previous LG issues. However, it is
hard to find. For one thing the desired features are difficult to
describe and the keywords that do cover it are far too general.
For example, so far the keywords we've used are:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
You: temporarily control VT
Me: attach re-attach detach screen session yank
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
... see?
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, here's the VERY short intro to 'screen':
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
First 'screen' just starts an extra shell. So, if you just type 'screen'
(most distributions include 'screen') that's pretty much all you'll get.
(You might get some sort of copyright or other notice). Now you can
run programs as usual. The only big difference is that there is one key
([Ctrl]-[A] by default) which is not captured by 'screen'. That one
"meta" key is your trigger to fire off all of 'screen&quot;s other features.
Here are a few of them (listed below as [Meta]+(key)):
</BLOCKQuote></BLOCKQUOTE>
<blockquote><pre> [Meta] [a] -- send a literal [Meta] to the current session
[Meta] [c] -- create an a additional shell session under
this 'screen'
[Meta] [w] -- display/list current sessions (windows)
[Meta] [A] -- (upper case 'A') set this session's (window's)
title
[Meta] [Esc] -- go into "scrollback" and "copy" mode (keyboard
cut &amp; paste)
[Meta] [Space] -- cycle to the next session
[Meta] [Meta] -- switch to most recent session
[Meta] []] -- (right square bracket) paste copy of "cut" buffer
[Meta] [?] -- Quick help page of other keystrokes
[Meta] [d] -- Detach
[Meta] [S] -- (upper case 'S') split the screen/display
(like 'splitvt')
[Meta] [Q] -- (upper case 'Q') unsplit the screen/display
[Meta] (digit) -- switch directly to session number (digit)
</pre></blockquote>
<BLOCKQUOTE>
There are many others. There are many features to 'screen.' It is
the UNIX/Linux terminal power tool. You also get the ability to
share your session(s) with another user (like the old 'kibitz'
package). That's very handy for doing online tutorial and tech
support. You get a scrollback buffer and keyboard driven cut and
paste (with 'vi' inspired keybindings, you can even search back
through the current text and backscroll buffer).
</BLOCKQUOTE>
<BLOCKQUOTE>
Most of the URLs you see in the "Answer Guy" are pasted in from
a 'lynx' session using 'screen.'
</BLOCKQUOTE>
<BLOCKQUOTE>
If you forget to detach, you can use the <TT>-d</TT> option (shown above)
to remotely detach a session. You can use other options to select
from multiple 'screen' sessions that you have detached. You can
also run 'screen' commands to start up programs in their own
screen windows.
</BLOCKQUOTE>
<BLOCKQUOTE>
Oddly enough I've even found that I occasionally start or
re-attach to one 'screen' session on a remote system from within a
local 'screen' session. When I do this I use the <TT>-e</TT> option to
give that other (remote) screen session a different meta key.
(That's what I did in the sample command up there, with the
'<TT>-e^]]</TT>' setting it up so that the [Ctrl][Right Square Bracket]
was the meta key for that session. I did that while I was at
work. Before I left there I detached it. When I got home I
re-attached it to this 'xterm' (where I'm typing right now).
At first I just re-attached it with '<TT>-r</TT>' <TT>---</TT> but then I realized
that it was using my other meta key. So a detached again and
use '<TT>-r^aa</TT>' to reset those to the defaults (to which I'm more
accustomed).
</BLOCKQUOTE>
<BLOCKQUOTE>
Since I've introduced people at <A HREF="http://www.linuxcare.com/">Linuxcare</A> to this meme, I've
found that many of them have come to view their "sessions"
in a way that's similar to me. We maintain our state for
weeks or months by detaching, logging out, going elsewhere
(into X, out of X, from work, from home, etc), and always
re-attaching to our ongoing sessions. It's a whole different
way of using your computer.
</BLOCKQUOTE>
<BLOCKQUOTE>
So, try it. See if it does the trick for you.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 11 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/12"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 12 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Running out of Pseudo-tty's</H3>
<p><strong>From FRM on Fri, 14 Apr 2000
</strong></p>
<!-- ::
Running out of Pseudo-tty's
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
hi,
</STRONG></P>
<P><STRONG>
my sunos 4.1.4 kernel is already configed for the max 256 pty's
(pseudo devices), but my users complain about running out of them
often. do i need to add files to the <TT>/dev</TT> directory or recompile the
kernel again...or????
</STRONG></P>
<P><STRONG>
any help much appreciated,
</STRONG></P>
<P><STRONG>
Randy A
Compaq Computer Corp.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
SunOS 4.1.4??? Hmm. Maybe you need an upgrade.
</BLOCKQUOTE>
<BLOCKQUOTE>
If 256 is the max for SunOS then I don't know what
you'd do to get around that. Under Linux the max is about 2048.
I suppose you could try making a bunch of additonal device nodes and
re-writing/compiling a bunch of your apps to open the new group of
nodes rather than the old ones.
</BLOCKQUOTE>
<BLOCKQUOTE>
I'd say that SunOS 4.1.4 is showing its age. You might want to
consider switching to <A HREF="http://www.openbsd.org/">OpenBSD</A>, <A HREF="http://www.netbsd.org/">NetBSD</A>, or Linux. (Note:
SunOS was a BSDish UNIX, so you might be more comfortable with
it than you would be with Linux. I don't know about binary
compatability for your existing applications).
</BLOCKQUOTE>
<BLOCKQUOTE>
(Obviously I don't know much about SunOS. I'm the <EM>LINUX</EM>
Gazette Answer Guy and my experience with other forms of UNIX
is too limited and crufty to help you more than that).
</BLOCKQUOTE>
<!-- sig -->
<!-- end 12 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/13"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 13 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>XFree 4.0 and &quot;:0.0 refused by server&quot; Errors</H3>
<p><strong>From Alain Toussaint on Sun, 16 Apr 2000
</strong></p>
<!-- ::
XFree 4.0 and &quot;:0.0 refused by server&quot; Errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hello Answerguy,
</STRONG></P>
<P><STRONG><CODE>
last week,i installed debian (a really base installation) on a factory
</CODE></STRONG></P>
<P><STRONG>
fresh disk and then set out to compile Xfree86 4.0 (i did not have X
previously),it did compile and work fine and i've been using it daily
with the startx command but wenesday this week,the hard disk on my
mother's computer died so i set out to build a linux boot disk
containing an X server so she could log in my system and continue to do
her work,i then tried xdm tonight (locally on my box first),xdm
loaded,took my credential but it did not open a session both as a user
(alain) and as root,i looked over in the .xession-errors file but i've
came to no conclusion,here's the content of the file:
</STRONG></P>
<pre><strong>&gt; /home/alain/.xinitrc: exec: xfwm: not found
&gt; /home/alain/.xinitrc: xscreensaver: command not found
&gt; Xlib: connection to ":0.0" refused by server
&gt; Xlib: Client is not authorized to connect to Server
&gt; xrdb: Can't open display ':0'
&gt; Xlib: connection to ":0.0" refused by server
&gt; Xlib: Client is not authorized to connect to Server
&gt; xrdb: Can't open display ':0'
&gt; Xlib: connection to ":0.0" refused by server
&gt; Xlib: Client is not authorized to connect to Server
&gt; xrdb: Can't open display ':0'
</strong></pre>
<P><STRONG>
the first 2 errors don't worry me much (i have xfce installed and for
xscreensaver,i don't want it,since i'll install kde soon,i'm not pressed
to fix the xfce script that much),but the Xlib errors worry me quite a
bit,i then downloaded debian's xdm package and uncompressed it in a
temporary directory to compare the content of both our <TT>/etc/X11/xdm</TT>
directory (mine as well as the debian one) but i didn't find the root of
the problem,could you please help me ??
</STRONG></P>
<P><STRONG>
Thanks a lot
Alain Toussaint
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Hmmm. It sounds like a problem with your .Xauthority file.
You said you were using 'startx' before, and you're now trying to
use 'xdm'. What happens if you go back and try 'startx' again?
</BLOCKQUOTE>
<BLOCKQUOTE>
'xdm' has a different way of handling the 'xauth' files (using
the 'GiveConsole' and 'TakeConsole' scripts). Do a 'ps' listing
and see if you have a X server with arguments like:
</BLOCKQUOTE>
<blockquote><pre> X :0 -auth /var/xdm/Xauthority
</pre></blockquote>
<BLOCKQUOTE>
There's supposed to be a "GiveConsole" script that does
something like:
</BLOCKQUOTE>
<blockquote><pre> xauth -f /var/xdm/Xauthority extract - :0 | xauth -f ~$USER/.Xauthority merge -
</pre></blockquote>
<BLOCKQUOTE>
(Which extracts an MIT Magic Cookie or other access token from xdm's
Xauthority file and merges it into the "cookie jar" of your user.
This can, in principle, allow multiple accounts on a host or across a
network to access the same display server).
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, there are many other tricks that you can use to troubleshoot
similar problems.
</BLOCKQUOTE>
<BLOCKQUOTE>
I sometimes will start the X server directly
(bypassing 'xinit', 'startx', and 'xdm'); then switch back to one
of my text mode consoles (usually when I'm doing this I slap the old
&amp; on the end of the X server's command line, if I forget then I do the
old [Ctrl]+[Z], 'bg' key and command). Next I 'export DISPLAY=:0'
(or :1, or whatever), and start an 'xterm &amp;'
</BLOCKQUOTE>
<BLOCKQUOTE>
At that point I switch back to the X virtual console, and use the
resulting 'xterm' to work more magic. I may need to run my own
'xrdb' commands to merge in my own entries into the "X resources
database" (think of that as being your X server's "environment" <TT>---</TT>
a set of name/pattern and value pairs which are used by X client
programs to determine their default appearance, behaviour, etc).
</BLOCKQUOTE>
<BLOCKQUOTE>
I might also run a number of 'xset' commands to add to my
font path and play with other settings.
</BLOCKQUOTE>
<BLOCKQUOTE>
Doing this sort of "worm's eye" inching through the labyrinthine
X initialization process will usually isolate any problems that
you're having. It's playing with X enough to realize that it's
going through all of these steps that's so difficult.
</BLOCKQUOTE>
<BLOCKQUOTE>
I presume that you already know some of that (since you've already
fetched your own XFree 4.0 sources and built them). It's clear
that you're not a novice. Anyway, trying looking for .Xauthority
files. Allegedly if you simply delete them it opens the X server
wide open. I don't know if that's still true in XFree 4.0 but
it seemed to work on XFree 3.x the one time I tried it.
</BLOCKQUOTE>
<BLOCKQUOTE>
Good luck on that new X server. I haven't grabbed it to play with
it yet. I may wait until someone has a first cut of a <A HREF="http://www.debian.org/">Debian</A>
binary posted to "woody" (the current development/experimental
branch of the Debian project).
</BLOCKQUOTE>
<!-- sig -->
<!-- end 13 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/14"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 14 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>FW: Linux</H3>
<p><strong>Answered By Carl Davis on Mon, 17 Apr 2000
</strong></p>
<BLOCKQUOTE>
Thanks Jim, but I have solved the mystery................
</BLOCKQUOTE>
<BLOCKQUOTE>
The problem was that lilo does not like multiple "append" statements in
/etc/lilo.conf.
I fixed this by putting all the statements on the one append line,
separated by commas
and of cotatement2, statement3"
You may wish to add this snippet to the list of 2cent tips.
</BLOCKQUOTE>
<BLOCKQUOTE>
Regards
</BLOCKQUOTE>
<BLOCKQUOTE>
Carl Davis
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
<TT>-----Original</TT> Message-----
From: Carl Davis
Sent: Thursday, April 13, 2000 9:12 AM
To: '<A HREF="mailto:linux-questions-only@ssc.com"
>linux-questions-only@ssc.com</A>'
Subject: Linux
</STRONG></P>
<P><STRONG>
Hi Jim,
</STRONG></P>
<P><STRONG>
My compliments on a great column. I am running Linux (Mandrake 7) on a
Celeron 466
with 128 Mb RAM. My problem is I cannot persuade Linux to recognise more
than 64 Mb.
I have tried adding the following to lilo.conf: append="mem=128M", to
no avail. It still
comes up with only 64 Mb. Various flavours of Windoze can see the full
128 Mb. Any ideas
on what's going on here ?
</STRONG></P>
<P><STRONG>
Carl Davis
</STRONG></P>
<!-- end 14 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/15"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 15 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Determining the Type of Each Filesystem</H3>
<p><strong>From Scott on Mon, 17 Apr 2000
</strong></p>
<!-- ::
Determining the Type of Each Filesystem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hello Answer guy,
</STRONG></P>
<P><STRONG>
The company I work for is going to start developing products for Linux soon.
Part of my preparation for this is to find out about Linux file systems.
One thing I haven't been able to find is how to find out what file system
each filesystem is using. Is there a command line utility that shows this?
How do I accomplish this programatically?
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Here's a simple shell script that will parse the output from the
'mount' command and isolate the device name and type for each mounted
filesystem:
</BLOCKQUOTE>
<blockquote><pre> mount | {
IFS=" (,)";
while read dev x mpoint x type opts; do
echo $dev $type;
done
}
</pre></blockquote>
<BLOCKQUOTE>
Notice at this is one of my common "data mill loops" <TT>---</TT> you
pipe the output of some command into a 'while read ...; do' loop
and do all your work in the subprocess. (When I'm teaching shell
scripting one of the first points I emphasize about pipes is
that a subprocess is implicitly made on one side of your pipe
operator, or the other).
</BLOCKQUOTE>
<BLOCKQUOTE>
We also see that I'm using the variable "$x" to eat extra
fields (the words "on" and "type" from 'mount&quot;s output). Finally,
I'm using the shell-special IFS (inter-field separator) shell variable
to add the characters "(,)" to the list of field separators. This
means that each of the mount options <TT>---</TT> read-only vs read/write, nodev,
nosuid, etc <TT>---</TT> will be treated as a separate value. I could then,
within my 'while' loop, nest a 'for' loop to process each option on
each filesystem.
</BLOCKQUOTE>
<BLOCKQUOTE>
Creative use of IFS and these 'while read ...; do' loops can allow
us to do quite a bit directly in shell without resorting to 'awk'
and/or 'sed' to do simple parsing. Creative use of the 'case'
command (which uses glob patterns to match shell variable values)
is also useful and can replace many calls to 'grep'.
</BLOCKQUOTE>
<BLOCKQUOTE>
To get filesystem information from within a C program you'd
use the <TT>'statfs()</TT>' or <TT>'fstatfs()</TT>' system calls. Read the
'statfs(2)' or 'fstatfs(2)' man pages for details. Fetch
the util-linux sources and read the source code to the
'mount' and 'umount' commands for canonical examples of
the use of these and related sytem calls.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Any help is appreciated!
</STRONG></P>
<P><STRONG>
Scott C
</STRONG></P>
<!-- end 15 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 15 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Which filesystem?</H3>
<p><strong>From Andrew T. Scott on Mon, 17 Apr 2000
</strong></p>
<BLOCKQUOTE>
Jim Dennis wrote:
.....
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
and do all your work in the subprocess. (When I'm teaching shell
scripting ...
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Where can I sit in on this class?
</BLOCKQUOTE>
<BLOCKQUOTE>
-Andrew
</BLOCKQUOTE>
<EM>[ <BLOCKQUOTE>
Luckily for <A HREF="http://www.linuxcare.com/">Linuxcare</A>, its training department has a whole bunch of people
in it (wave hi, everybody!) because they've got Jim assigned to Do Cool Stuff
so he's not teaching right now. To be fair, they are only one among many
training providers for Linux; you can see a decent listing at
<A HREF="http://www.lintraining.com"
>http://www.lintraining.com</A> which redirects to Linsight's directory by
location and news on the subject.
</BLOCKQUOTE><P>-- Heather. ]</P></EM>
<!-- end 15 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/16"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 16 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Four Questions</H3>
<p><strong>From vg24 on Tue, 18 Apr 2000
</strong></p>
<!-- ::
Four Questions
~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hi Answer Guy,
</STRONG></P>
<P><STRONG>
I had a few small questions about my <A HREF="http://www.slackware.org/">Slackware</A> Linux Box...
</STRONG></P>
<pre><strong>&gt; (1) How do I get applications (like xmms) to startup automatically when I
&gt; start FVWM95 with a 'startx' command? I'm hoping to achieve something
&gt; similar to the "StartUp" menu in Win98.
</strong></pre>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Normally the 'startx' command is a shell script which looks for a
~/.Xclients file. That file is normally just another shell script.
It consists of a series of command that are started in the background
(using the trailing '&amp;' shell operator), and one command that is
'exec&quot;d (started in the foreground, and used to replace the shell
script's interpreter itself.
</BLOCKQUOTE>
<BLOCKQUOTE>
That foreground command is usually a window manager. In any event it
becomes the "session manager" for the X server. When the program exits,
the X server takes that as an indication that it should shutdown.
</BLOCKQUOTE>
<BLOCKQUOTE>
So, the answer to your question is to add the appropriate commands to
the .Xclients script in your home directory.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you are logging in via 'xdm' (a graphical login program) then it
may be that your system is looking for an ~/.Xsession script instead.
I usually just link to two names to one file. However, you certainly
could have completely different configurations based on whether you
logged in via 'xdm' or used the 'startx' command.
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course this is just a matter of convention and local policy. As I
said, 'startx' itself is often a shell script. At some sites you use
'xinit' instead of 'startx' <TT>---</TT> and others there are different ways
to launch the X server and completely different ways to start the various
clients that run under it and control it.
</BLOCKQUOTE>
<BLOCKQUOTE>
You mentioned fvwm95. This is one of several variants of the fvwm
window manager. That's a traditional window manager. It just gives
you a set of menus (click on the "root window" which other windowing
systems call a "wallpaper" with each of your mouse buttons to see those),
and a set of window decorations (resizing bars, corners, and title bars
and buttons).
</BLOCKQUOTE>
<BLOCKQUOTE>
In recent years the open source community has created somewhat more
elaborate and "modern" graphical user environments like: <A HREF="http://www.kde.org/">KDE</A>, <A HREF="http://www.gnome.org/">GNOME</A>,
and GNUStep. These are whole suites of programs which can be combined
to provide the sort of look, feel and facilities that people have
come to expect from MacOS, MSWindows, etc.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you really want something "Like the StartMenu" in Win'9x
then you may want to look at KDE or GNOME. These have "panels" which
provide a much closer analogue to the environment that you are
used to.
</BLOCKQUOTE>
<BLOCKQUOTE>
(Note: It is also possible to make either of these environments
look completely different than MS Windows. They both support
"themes" which are collections of settings, graphics, textures,
icons, even sounds, that customize the appearance and operation of
a Linux GUI. For more information and some nice screen shots of
the possibilities, take a look at <A HREF="http://www.themes.org"
>http://www.themes.org</A>).
</BLOCKQUOTE>
<blockquote><pre>&gt; (2) I recently upgraded my kernel and filesystem binaries from a 2.034 kernel
&gt; to a 2.2.13 kernel. I have XFree86 3.3.5 installed. I also upgraded
&gt; my motherboard from an Intel P75 to an AMD K6-450. I kept the 32 Megs
&gt; of RAM the same (a SIMM). However, now I notice that Netscape (and
&gt; others?) grind my hard drive more when I attempt to open new
&gt; browsers. I'm pretty sure I'm low on memory, but since I'm low in
&gt; cash, I'd rather not invest in a DIMM. I didn't have any swap space
&gt; set up, and don't now. I actually upgraded from netscape 4.1 to 4.6.
&gt; Could this be the problem?
</pre></blockquote>
<BLOCKQUOTE>
Hmmm. Certainly it is likely that Netscape 4.6 is taking up more
memory than 4.1. However I note an inconsistency here. You say you
didn't have any swap space. If that was true then your shortage of
memory should have caused failures when trying to launch programs
<TT>---</TT> rather than the increased disk thrashing. I think it's likely
that you actually do have some swap space. You can use the following
command to find out what swap partitions and files are active on your
system:
</BLOCKQUOTE>
<blockquote><pre> cat /proc/swaps
</pre></blockquote>
<BLOCKQUOTE>
... which should provide a list of any swap space that is in use.
Of course the 'free' command will also summarize the available and
used swap space. However, the <TT>/proc/swaps</TT> "psuedo-file" (node) will
actually tell you "where" the swap is located.
</BLOCKQUOTE>
<BLOCKQUOTE>
Get the extra memory. It's not that expensive and it is the
best performance upgrade that you can make for your system.
</BLOCKQUOTE>
<blockquote><pre>&gt; (3) I was running GNOME/enlightenment, but the
&gt; GNOME panel would never come up automatically. How can I get the
&gt; GNOME panel to initialize, along with the GNOME file manager, (so
&gt; I can have the cool desktop icons)?
</pre></blockquote>
<BLOCKQUOTE>
Hmmm. I'm not much of a GNOME or KDE person. Do you have the rest
of GNOME installed? enlightenment is a window manager. It was the
default window manager for GNOME <TT>---</TT> but they are separate projects.
So, do you have GNOME installed? Are you starting 'gnome-session'
(running it from your .Xclients/.Xsession script as described above)?
</BLOCKQUOTE>
<BLOCKQUOTE>
Try that. I think there are now a couple of window managers that
implement the GNOME hints and APIs <TT>---</TT> so you don't have to use
enlightenment.
</BLOCKQUOTE>
<blockquote><pre>&gt; (4) Lastly, I wanted to trim my syslog and wtmp files. Is there any
&gt; way I can do this? Can I just tail -30 the last 30 lines into a
&gt; new file? I think the wtmp is binary, so any ideas?
</pre></blockquote>
<BLOCKQUOTE>
You are correct. the wtmp and utmp files are binary. They cannot be
trimmed with simple shell scripts and text utilities. The utmp file
shouldn't grow (by much), however the wtmp will grow without bound.
However, the usual way of dealing with wmtp is to simply rename the
current one, 'touch' a new one and forget about it.
</BLOCKQUOTE>
<BLOCKQUOTE>
That's fine for wtmp.
</BLOCKQUOTE>
<BLOCKQUOTE>
However, DON'T try that with the <TT>/var/log/messages</TT> or other
syslog files. Those are held up. If you rename them or
delete them, they continue to grow.
</BLOCKQUOTE>
<BLOCKQUOTE>
Yes! You read that correctly, if you remove a file while some
process has it open, then you haven't freed up any disk space!
That's because the 'rm' command just does an <TT>'unlink()</TT>' system call.
When the last link to a file is removed, AND THE FILE IS NOT OPEN,
then the filesystem drivers perform some housekeeping to mark the
associated inode(s) as available, and to add all the associated data
blocks to the filesystem's "free list." If the file is still open
then that housekeeping is deferred until it is closed.
</BLOCKQUOTE>
<BLOCKQUOTE>
So the usual way to trim syslog files (since syslog stays
running all the time, and keeps it's files open under normal
circumstances) is to to 'cp <TT>/dev/null</TT>' or 'echo "" &gt; ' to
truncate them. Another common practice is to remove the
files and use the 'kill <TT>-HUP</TT> $(cat <TT>/var/run/syslog.pid</TT>)' command
to force the syslogd to re-read its configuration file,
close all its files, and re-open them.
</BLOCKQUOTE>
<BLOCKQUOTE>
However, none of that should be necessary. Every other
general purpose distribution has some sort of log rotation
scripts that are run out of 'cron.' I'm pretty sure that
Patrick (Volkerding, principle architect of Slackware) didn't
neglect that.
</BLOCKQUOTE>
<BLOCKQUOTE>
(I should point out that I haven't used Slackware in several
years. Nothing against it. I just have too few machines and
too little time).
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Thanks for any help you can provide!
Vikas Gupta
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Well, I think this should nudge you in the right directions.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 16 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/17"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 17 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>G-Kermit: The GPL Kermit Transfer Package</H3>
<p><strong>From Deepu Chandy Thomas on Tue, 18 Apr 2000
</strong></p>
<!-- ::
G-Kermit: The GPL Kermit Transfer Package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Sir,
</STRONG></P>
<P><STRONG>
I wanted to use the kermit protocol with minicom. I use rz sz for
zmodem. Where do I get the files for kermit?
</STRONG></P>
<P><STRONG>
Regards,
Deepu
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Look at <A HREF="http://www.columbia.edu/kermit"
>http://www.columbia.edu/kermit</A> for canonical information
about all the official Kermit packages, and at:
<A HREF="http://www.columbia.edu/kermit/gkermit.html"
>http://www.columbia.edu/kermit/gkermit.html</A> for information
specifically about the GPL kermit package (which implements
the file transfer protocol without the scripting, dialing and
other features of C-Kermit).
</BLOCKQUOTE>
<BLOCKQUOTE>
(Note: C-Kermit can also be used as a 'telnet' or 'rsh' client
with a scripting language, and many other useful features. It
is a full featured communications package. Recent versions have
even added Kerberos support!)
</BLOCKQUOTE>
<!-- sig -->
<!-- end 17 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/18"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 18 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
><TT>./script:</TT> No such file or directory</H3>
<p><strong>From Alex Brak on Fri, 14 Apr 2000
</strong></p>
<!-- ::
<TT>./script:</TT> No such file or directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
I'm having a problem with my linux box, and can't for the life of me
figure out what's wrong. Here are the symptoms:
</STRONG></P>
<pre><strong>&gt; server:~/scripts$ whoami
&gt; alex
&gt; server:~/scripts$ ls -al ./script
&gt; - -rwxr----- 1 alex home 43747 Apr 10 22:31 ./script*
&gt; server:~/scripts$ ./script
&gt; bash: ./script: No such file or directory
</strong></pre>
<P><STRONG>
(note: the '*' at the tail end of the file listing is merely a symbol
specifying that its an executable file. this is not part of the
filename)
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Technically that "file type marker" is the result of using the
<TT>-F</TT> option to 'ls'
</BLOCKQUOTE>
<BLOCKQUOTE>
The most likely cause of this problem is the #! (shebang) line
that should be at the beginning of your script. If that is
incorrect then it is common to get this error, your shell is
telling you that it can't find the script's interpreter.
</BLOCKQUOTE>
<BLOCKQUOTE>
If '<TT>./script</TT>' was a binary executable thenI'd also suggest looking
for missing shared libraries. In fact, it's possible that your
shebang line is pointing to some interpreter (<TT>/usr/local/ksh</TT> or
something) which is present, and executable, but is missing some
shared library. It is even possible that a shared library depends
on another, and that this is what is missing.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
As you can see from the above, I'm the owner of the file in question,
and have execute permission on it. The file exists. Yet bash claims
the file is not there. I've tried with shells other than bash (every
other shell available on my system, including csh, tcsh, ash, and
zsh). I've even tried executing the command
as root, to no avail.
</STRONG></P>
<P><STRONG>
This exact same problem has arisen before with another script I
wrote. I couldn't fix it then, either.
</STRONG></P>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
Check your shebang line. It should read something like:
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<blockquote><pre>#!/bin/sh
</pre></blockquote>
<BLOCKQUOTE>
Note: there are NO SPACES in this line. Do NOT put a space
between the #! and the interpreter's name.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I'd like to also note that this problem arises intermittently: just
after finishing ~/scripts/script I created another script named
"test", did chmod u+x on it and it executed just fine.
~scripts/script still refuses to execute, though :( Please note that I've
tried renaming the file. I've also tried moving it to another location on
the directory tree. None of these have helped.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
A text file without any shebang line, which is marked as executable
will be executed through some magic that is dependent on the shell
wfrom which it is being invoked.
</BLOCKQUOTE>
<BLOCKQUOTE>
I'll probaby get this wrong in the details but the process works
something like this:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
You issue a command. The shell tries to simply<TT> exec()</TT> it (after
performing the command line parsing necessary to expand any file
"globs" and replace any shell variables, command substitution
operators, parameter expansion, etc). If that execution fails the
shell may attempt to call it with $SHELL <TT>-c</TT> (or it might do something
a bit different: that seems to be shell dependent).
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
Notice that the behaviour in the first case is well-defined. Linux
has a binfmt_script module (usually compiled/linked statically into
your kernel) which handles a properly formatted shebang line.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I have not experienced any other problems with my system that I'm
aware of. Does anyone know what could be causing this, or how to fix
the problem?
</STRONG></P>
<P><STRONG>
I'm running linux 2.2.14 on my Pentium 120, with a <A HREF="http://www.slackware.org/">Slackware</A>
distribution. The file in question exists on the root partition, in
an ext2 file system, which the kernel supports. If there's any other
relevant information I have provided, please don't hesitate to ask.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
If you were getting "operation not permitted" I'd suggest checking your
mount options to see if the filesystem was mounted 'noexec' (which
would be a very badd idea for your root fs). If you were getting
a message like "cannot execute binary" then I'd think that maybe
you had an old a.out binary and a kernel without the a.out binfmt
support.
</BLOCKQUOTE>
<BLOCKQUOTE>
But I'm pretty sure that you're having a problem with your shebang
line.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Thanks,
Alex
</STRONG></P>
<!-- sig -->
<!-- end 18 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 18 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
><TT>./script:</TT> No such file or directory</H3>
<p><strong>From Alex Brak on Sun, 16 Apr 2000
</strong></p>
<BLOCKQUOTE>
Sport on. Many thanks.
</BLOCKQUOTE>
<BLOCKQUOTE>
Alex
</BLOCKQUOTE>
<BLOCKQUOTE>
<TT>-----Original</TT> Message-----
From: Jim Dennis [mailto:<A HREF="mailto:jimd@starshine.org"
>jimd@starshine.org</A>]
Sent: Saturday, 15 April 2000 9:07 AM
To: Alex Brak
Cc: <A HREF="mailto:star@starshine.org"
>star@starshine.org</A>; <A HREF="mailto:jdennis@<A HREF="http://www.linuxcare.com/">Linuxcare</A>.com"
>jdennis@<A HREF="http://www.linuxcare.com/">Linuxcare</A>.com</A>; <A HREF="mailto:tdavey@<A HREF="http://www.linuxcare.com/">Linuxcare</A>.com"
>tdavey@<A HREF="http://www.linuxcare.com/">Linuxcare</A>.com</A>;
<A HREF="mailto:bneely@linuxcare.com"
>bneely@linuxcare.com</A>; <A HREF="mailto:sg@linuxcare.com"
>sg@linuxcare.com</A>
Subject: Re: shell cannot see an existing file
</BLOCKQUOTE>
<!-- ::
<TT>./script:</TT> No such file or directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
I'm having a problem with my linux box, and can't for the life of me
figure out what's wrong. Here are the symptoms:
</STRONG></P>
<pre><strong>&gt; server:~/scripts$ whoami
&gt; alex
&gt; server:~/scripts$ ls -al ./script
&gt; - -rwxr----- 1 alex home 43747 Apr 10 22:31 ./script*
&gt; server:~/scripts$ ./script
&gt; bash: ./script: No such file or directory
</strong></pre>
<P><STRONG>
(note: the '*' at the tail end of the file listing is merely a symbol
specifying that its an executable file. this is not part of the
filename)
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Technically that "file type marker" is the result of using the
<TT>-F</TT> option to 'ls'
</BLOCKQUOTE>
<BLOCKQUOTE>
The most likely cause of this problem is the #! (shebang) line
that should be at the beginning of your script. If that is
incorrect then it is common to get this error, your shell is
telling you that it can't find the script's interpreter.
</BLOCKQUOTE>
<BLOCKQUOTE>
If '<TT>./script</TT>' was a binary executable thenI'd also suggest looking
for missing shared libraries. In fact, it's possible that your
shebang line is pointing to some interpreter (<TT>/usr/local/ksh</TT> or
something) which is present, and executable, but is missing some
shared library. It is even possible that a shared library depends
on another, and that this is what is missing.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
As you can see from the above, I'm the owner of the file in question,
and have execute permission on it. The file exists. Yet bash claims
the file is not there. I've tried with shells other than bash (every
other shell available on my system, including csh, tcsh, ash, and
zsh). I've even tried executing the command
as root, to no avail.
</STRONG></P>
<P><STRONG>
This exact same problem has arisen before with another script I
wrote. I couldn't fix it then, either.
</STRONG></P>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
Check your shebang line. It should read something like:
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<blockquote><pre>#!/bin/sh
</pre></blockquote>
<BLOCKQUOTE>
Note: there are NO SPACES in this line. Do NOT put a space
between the #! and the interpreter's name.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I'd like to also note that this problem arises intermittently: just
after finishing ~/scripts/script I created another script named
"test", did chmod u+x on it and it executed just fine.
~scripts/script still refuses to execute, though :( Please note that I've
tried renaming the file. I've also tried moving it to another location on
the directory tree. None of these have helped.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
A text file without any shebang line, which is marked as executable
will be executed through some magic that is dependent on the shell
wfrom which it is being invoked.
</BLOCKQUOTE>
<BLOCKQUOTE>
I'll probaby get this wrong in the details but the process works
something like this:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
You issue a command. The shell tries to simply<TT> exec()</TT> it (after
performing the command line parsing necessary to expand any file
"globs" and replace any shell variables, command substitution
operators, parameter expansion, etc). If that execution fails the
shell may attempt to call it with $SHELL <TT>-c</TT> (or it might do something
a bit different: that seems to be shell dependent).
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
Notice that the behaviour in the first case is well-defined. Linux
has a binfmt_script module (usually compiled/linked statically into
your kernel) which handles a properly formatted shebang line.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I have not experienced any other problems with my system that I'm
aware of. Does anyone know what could be causing this, or how to fix
the problem?
</STRONG></P>
<P><STRONG>
I'm running linux 2.2.14 on my Pentium 120, with a <A HREF="http://www.slackware.org/">Slackware</A>
distribution. The file in question exists on the root partition, in
an ext2 file system, which the kernel supports. If there's any other
relevant information I have provided, please don't hesitate to ask.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
If you were getting "operation not permitted" I'd suggest checking your
mount options to see if the filesystem was mounted 'noexec' (which
would be a very badd idea for your root fs). If you were getting
a message like "cannot execute binary" then I'd think that maybe
you had an old a.out binary and a kernel without the a.out binfmt
support.
</BLOCKQUOTE>
<BLOCKQUOTE>
But I'm pretty sure that you're having a problem with your shebang
line.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Thanks,
Alex
</STRONG></P>
<!-- sig -->
<!-- end 18 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/19"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 19 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>hello</H3>
<p><strong>From Credit Future Commercial MACAU Company on Wed, 5 Apr 2000
</strong></p>
<BLOCKQUOTE>
Hello sir
</BLOCKQUOTE>
<BLOCKQUOTE>
I installed red hat 6.1 on my system but it does not display more =
</BLOCKQUOTE>
<BLOCKQUOTE>
then 256 colours although my vga card is a 16 MB vodoo why is that can =
you help me out here ???I have tried startx <TT>-bpp16</TT> but still my pics =
"jpegs , bmp " qualities isnt fine !!! &amp; are displayed in dots same pic =
in windows look good .
</BLOCKQUOTE>
<BLOCKQUOTE>
thanksfaisal
</BLOCKQUOTE>
<!-- end 19 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 19 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>hello</H3>
<p><strong>From Heather on Wed, 5 Apr 2000
</strong></p>
<P><STRONG>
Hello sir
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Heather isn't a masculine name in the U.S. I'll assume this is intended
for the Answer Guy column, and give a first shot at answering it.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I installed red hat 6.1 on my system but it does not display more then
</STRONG></P>
<P><STRONG>
256 colours although my vga card is a 16 MB vodoo why is that can you help
me out here ???I have tried startx <TT>-bpp16</TT> but still my pics "jpegs , bmp "
qualities isnt fine !!! &amp; are displayed in dots same pic in windows look
good .
thanksfaisal
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
You have not specified what resolution under MSwin had the qualities you seek.
Under X, you must run the correct video server to match your card if you want
best performance, but you can nearly always get the screen <EM>working</EM> with a
lesser server.
</BLOCKQUOTE>
<BLOCKQUOTE>
The VGA16 server only provides 256 color service. If this is what you are
stuck at, you might be using this. Or, your <TT>/etc/X11/XF86Config</TT> file may
be telling it to default to this level <TT>-</TT> the command to change the default
is
startx <TT>--</TT> <TT>-bpp</TT> 16
</BLOCKQUOTE>
<BLOCKQUOTE>
with the space. Also, startx is a shell script, and launches a particular
server... usually <TT>/usr/X11R6/bin/X</TT> which itself is a link to the real one...
and so, you may be running a server you didn't intend.
</BLOCKQUOTE>
<BLOCKQUOTE>
Good luck with your JPEGs.
</BLOCKQUOTE>
<!-- end 19 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 19 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>hello again</H3>
<p><strong>From fai, Answered By Heather Stern on Fri, 7 Apr 2000
</strong></p>
<P><STRONG>
Thanks for the help it worked Finally !!!!
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Glad to hear it worked for you. Sorry I wasn't able to reply in
email in a timely fashion <TT>-</TT> publishing deadlines, you know.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Can you help me a bit more while telling me that i want to start this
command by default startx <TT>--</TT> <TT>-bpp</TT> 32 how can i do this ????
</STRONG></P>
<P><STRONG>
thanks
Faisal
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
One way would be to creat .xserverrc in your own home directory;
you'd have to specify your X server, but then you could pass it
parameters too:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
<TT>/usr/X11R6/bin/XF86_SVGA</TT> <TT>-bpp</TT> 32
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
Assuming that's the right server for you, of course. If startx
is just plain "getting it right" except for that itty bitty detail
of colordepth, you could instead create a bash alias or put a one-liner
shell script in your path. I like to keep such personal scripts
in ~/bin (that's bin under my home directory). name it something
much shorter like myX and save some typing too.
</BLOCKQUOTE>
<EM>[ <BLOCKQUOTE>
So where was Jim on this one? Well, he liked my answer, and was
busy with other questions and stuff to do.
</BLOCKQUOTE><P>-- Heather. ]</P></EM>
<!-- end 19 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/20"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 20 -->
<H3 align="left"><img src="../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>Shutting Down the Ping Daemon: Revised</H3>
<p><strong>Answered By Nadeem Hasan on Mon, 03 Apr 2000
</strong></p>
<!-- ::
Shutting Down the Ping Daemon: Revised
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
This is in reference to above question in "The answer Guy"
and its answer. The use of ipchains/ipfwadm is a bit of an
overkill to achieve this. The better way is to simply use
the following as root:
</STRONG></P>
<P><STRONG><CODE>
echo 1 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all
</CODE></STRONG></P>
<P><STRONG>
This should cause the kernel to ignore all the ping ICMP
requests.
</STRONG></P>
<P><STRONG>
Cheers,
--
Nadeem
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Just when you think you know everything.
</BLOCKQUOTE>
<!-- end 20 -->
<!-- . . . . . . . . . . . . . . . . . . . -->
<HR WIDTH="40%" ALIGN="center">
<!-- begin 20 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Revisionist Requests</H3>
<p><strong>From Nadeem Hasan on Tue, 11 Apr 2000
</strong></p>
<!-- ::
Revisionist Requests
~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
The Gazette still has the old description about disabling
ping echo responses. Does that mean its better than what
I suggested?
</STRONG></P>
<P><STRONG>
Nadeem
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I don't have the power to change what I've published in previous
months. Your (better) suggestion on how to disable the Linux
kernel's ICMP echo responses (to 'ping' requests) should appear in
next month's issue.
</BLOCKQUOTE>
<BLOCKQUOTE>
Now, what was that magic <TT>/proc</TT> node again?
</BLOCKQUOTE>
<BLOCKQUOTE>
Ahh, here it is:
</BLOCKQUOTE>
<blockquote><pre> echo 1 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all
</pre></blockquote>
<BLOCKQUOTE>
... I'd never remember that, but the node is there and I'd
recognize the meaining from the name. (So it's in my passive
rather than active vocabulary).
</BLOCKQUOTE>
<BLOCKQUOTE>
There are some other interesting nodes there <TT>---</TT> and I think
the one about "icmp_echo_ignore_broadcasts" looks useful.
</BLOCKQUOTE>
<BLOCKQUOTE>
It would be neat if someone wanted to write up a HOWTO on
"Useful <TT>/proc</TT> Tips and Tricks" (hint, hint). I've done some
performance tuning by tweaking and playing with some of the
entries under <TT>/proc/sys/vm</TT> (the virtual memory sysctl's), and
I know others have even done better than I could (back at
<A HREF="http://www.linuxcare.com/">Linuxcare</A>, I had to call on our <EM>real</EM> experts to help me out
awhile back for one gig).
</BLOCKQUOTE>
<BLOCKQUOTE>
I guess the tips would fall into two or three general categories:
robustness, security, and performance. For example the
<TT>/proc/sys/kernel/cap-bound</TT> (bounding capabilities set) can be
modified to secure some facilities even from a subverted 'root'
process (like the BSD securelevel features), and I guess that
<TT>/proc/sys/vm/overcommit_memory</TT> might allow one to prevent the
system from overcommit (providing for more robust operation
at the expense of reducing our capacity to run multiple
concurrent "memory hogs" that ask for more core than they actually
need).
</BLOCKQUOTE>
<BLOCKQUOTE>
A good HOWTO would be organized by objective/situation
(Increasing File Server Performance, Limiting Damage by
Subverted and Rogue Processes (Crackers), etc) and would include
notes on the tradeoffs that each setting entails. For example
one might disable ICMP response (for security?) but one should
be aware that anyone who has a legimate reason to access ANY
other service on your system might want to 'ping' it first to
ensure that it is reachable before they (or their programs) will
attempt to access any other service on it. (In other words it
makes no sense to disable ICMP responses on a web, mail, DNS,
FTP or other public server).
</BLOCKQUOTE>
<BLOCKQUOTE>
Unfortunately I don't have the time, nor nearly enough expertise
to write this. There are already some notes in the Linux kernel
source trees under <TT>/usr/src/linux/Documentation/sysctl/</TT> and I
remember that someone is working on a tool to automate some of
this PowerTweak/Linux (<A HREF="http://linux.powertweak.com/news.html"
>http://linux.powertweak.com/news.html</A>)
comes to mind.
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, enough on that.
</BLOCKQUOTE>
<!-- end 20 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/21"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 21 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Remotely Executing Graphic Apps</H3>
<p><strong>From Apichai T. on Mon, 03 Apr 2000
</strong></p>
<!-- ::
Remotely Executing Graphic Apps
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Dear sir,
</STRONG></P>
<P><STRONG>
May I ask for your advice , the steps to set up linux box to be
possible to remotely execute graphical applications.
</STRONG></P>
<P><STRONG>
Thanks and Best regards,
Jing
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Here's a couple of HOWTO and mini-HOWTO links:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Remote X Apps mini-HOWTO
<DD><A HREF="http://www.linuxdoc.org/HOWTO/mini/Remote-X-Apps.html"
>http://www.linuxdoc.org/HOWTO/mini/Remote-X-Apps.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
(I've copied it's author, Vincent Zweije, on this reply).
</BLOCKQUOTE>
<BLOCKQUOTE>
I don't recommend using his example shell script from section 6.2:
</BLOCKQUOTE>
<blockquote><pre>!/bin/sh
cookie=`mcookie`
xauth add :0 . $cookie
xauth add "$HOST:0" . $cookie
exec /usr/X11R6/bin/X "$@" -auth "$HOME/.Xauthority"
</pre></blockquote>
<BLOCKQUOTE>
The problem here is that the cookie variable is exposed on these
command lines (which is world readable via <TT>/proc</TT> and the 'ps'
command). It may also be exposed if it is exported to the
environment. Safe handling must be done through pipes or files
(or file descriptors). Note that the window of exposure is small
<TT>---</TT> but unnecessary. Read the 'xauth' man page for more details.
</BLOCKQUOTE>
<BLOCKQUOTE>
Better yet: Use ssh! (Read Vincent's HOWTO for more on that).
</BLOCKQUOTE>
<BLOCKQUOTE>
I also notice that Vincent doesn't distinguish between the session
manager and the window manager. In practice they are almost
always the same program. However here's the difference:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
The session manager is the one program that is started in the
foreground during the startx or xinit process. The X server
tracks this one process ID. When it dies, the X server takes
that as a signal to shutdown. Any program (an 'xterm', a copy
of 'xclock' or whatever) can be the session manager.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
The window manager is the program that receives events for the
"root window" (the X Windows System term for what other
windowing systems call the "wall paper" or "desktop" or
"backdrop"). There's also quite a bit more to what the window
manager does. You can only run one window manager on any X
server at any time. Window managers (can?) implement a number
of APIs that are unique to them <TT>---</TT> so you can just use "any"
X program as your window manager.
</BLOCKQUOTE>
<BLOCKQUOTE>
It's a subtle distinction since almost everybody uses their window
manager as their session manager.
</BLOCKQUOTE>
<BLOCKQUOTE>
Note: If you're troubleshooting X connections keep in mind that
the client must be able to connect to the server via the
appropriate socket. For example, to connect to the server on :0
(localhost/unix:0) the program must be able to access the UNIX
domain socket (usually in sockets that are located in <TT>/tmp/.X11-unix/</TT>)
Obviously<TT> chroot()</TT> jails could interfere with that (though
localhost:0, which is the same as localhost/tcp:0 should still
work).
</BLOCKQUOTE>
<BLOCKQUOTE>
A subtle and rare problem might be if someone were to try running
X after building a kernel without support for UNIX domain sockets.
It's possible to build a Linux kernel with full support for TCP/IP
and yet leave out the support for UNIX domain sockets.
</BLOCKQUOTE>
<BLOCKQUOTE>
Obviously when looking at Internet domain sockets (TCP/IP) any of
the usual routing, addressing, and packet filtering issues can
interfere with your clients attempts to connect to port 6000
(or 6001, 6002, etc) on the X server host.
</BLOCKQUOTE>
<BLOCKQUOTE>
For a little more on remote access to X server look at VNC
(Virtual Network Computing from AT&amp;T Laboratories Cambridge:
<A HREF="http://www.uk.research.att.com/vnc"
>http://www.uk.research.att.com/vnc</A>) (VNC was originally
developed at the Olivetti Research Laboratory, which was later
acquired by AT&amp;T).
</BLOCKQUOTE>
<BLOCKQUOTE>
You don't need this to just run X clients on your X server.
However, it's useful to learn about VNC in case you need some of
the special features that it provides.
</BLOCKQUOTE>
<BLOCKQUOTE>
Another good site for finding links to lots of information about
X is at Kenton Lee's "X Sites" (<A HREF="http://www.rahul.net/kenton/xsites.html"
>http://www.rahul.net/kenton/xsites.html</A>)
There are about 700 links located there!
</BLOCKQUOTE>
<BLOCKQUOTE>
Note that while X is currently the dominant windowing system for
Linux there are other efforts out there including "Berlin"
(<A HREF="http://www.berlin-consortium.org"
>http://www.berlin-consortium.org</A>) and the "Y Window System"
(<A HREF="http://www.hungry.com/products/Ywindows"
>http://www.hungry.com/products/Ywindows</A>). I don't know how
these projects are going. I see that the Berlin home pages have
been updated recently while the Y Window System pages seem to
have been stale since March of 1998.
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyway, good luck.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 21 -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 2000, James T. Dennis
<BR>Published in <I>The Linux Gazette</I> Issue 53 May 2000</H5>
<H6 ALIGN="center">HTML transformation by
<A HREF="mailto:star@tuxtops.com">Heather Stern</a> of
Tuxtops, Inc.,
<A HREF="http://www.tuxtops.com/">http://www.tuxtops.com/</A>
</H6>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- *** BEGIN navbar *** -->
<A HREF="lg_bytes53.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<IMG ALT=""
SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom" >
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<A HREF="../faq/index.html"><IMG ALT="[ FAQ ]"
SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A>
<IMG ALT=""
SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom" >
<A HREF="lg_tips53.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A>
<!-- *** END navbar *** -->
</BODY></HTML>
<!--endcut ========================================================= -->