old-www/LDP/LG/issue92/lg_tips.html

1257 lines
49 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Language" CONTENT="en-us">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="generator" CONTENT="lgazmail v1.4G.i">
<LINK REV="made" href="mailto:%20linux-questions-only@ssc.com%20"><TITLE>More 2 Cent Tips &amp; Tricks LG #92</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!--endcut ==============================================-->
<!--startcut =========================================================-->
<!-- *** BEGIN navbar *** -->
<A HREF="lg_mail.html">&lt;&lt;&nbsp;Prev</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="index.html">TOC</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../index.html">Front Page</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue92/lg_tips.html">Talkback</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../faq/index.html">FAQ</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="lg_answer.html">Next&nbsp;&gt;&gt;</A>
<!-- *** END navbar *** -->
<!--endcut ===========================================================-->
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD>
<center>
<BIG><BIG><STRONG><FONT COLOR="maroon">More 2&cent; Tips!</FONT></STRONG></BIG></BIG><BR>
<!-- BEGIN tips -->
<STRONG>By <A HREF="mailto:linux-questions-only@ssc.com">The Readers of <i>Linux Gazette</I></A></STRONG></BIG>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<center><STRONG>See also: The Answer Gang's
<a href="../tag/kb.html">Knowledge Base</a>
and the <i>LG</i>
<a href="http://www.linuxgazette.com/search.html">Search Engine</a></STRONG>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#tips.1"
><strong>Backup Software: Robustness</strong></a>
<li><A HREF="#tips.2"
><strong>can I have Linux on a ThinkPad G40? with WinXP?</strong></a>
<li><A HREF="#tips.3"
></a>Re: [Blt-newuser] Request suggestion for ftp server --or--
<br><A HREF="#tips.3"
><strong>FTP Daemons (Servers) and Alternatives: Just Say No?</strong></a>
<li><A HREF="#tips.4"
><strong>Pause after running xterm</strong></a>
<li><A HREF="#tips.5"
><strong>Tips on PDF conversion</strong></a>
<li><A HREF="#tips.6"
><strong>quotas on directories?</strong></a>
<li><A HREF="#tips.7"
><strong>What is Reverse DNS?</strong></a>
<li><A HREF="#tips.8"
><strong>Subscribe to groups...........pan,Knode.......????</strong></a>
<li><A HREF="#tips.9"
><strong>Confused about symantics of "mount -o,async/sync" commands</strong></a>
<li><A HREF="#tips.10"
><strong>Linux Journal Weekly News Notes - Tech Tips</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Backup Software: Robustness</FONT></H3>
Mon, 2 Jun 2003 08:09:29 +1000
<BR>Nick Coleman (<a href="mailto:linux-questions-only@ssc.com?cc=njpc@ozemail.com.au&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%231">njpc from ozemail.com.au</a>)
<P>
This is a reply to a letter to the Mailbag in the June 2003 issue of
Linux Gazette,
<a href="../issue91/lg_mail.html#wanted.1">compressed tape backups</a>
</P>
<P><STRONG>
quite a while back I remember a discussion on compressed tar archives on
tape and the security risk, i.e. the data would be unrecoverable behind
the first damaged bit.
</STRONG></P>
<P><STRONG>
Now at that time I knew that bzip2, unlike gzip, is internally a
blocking algorithm and it should be possible to recover all undamaged
blocks after the damaged one.
</STRONG></P>
<P><STRONG>
Your correspondent may like to look into afio instead of tar for
backups. I believe it recovers from errors much better. The mondo
rescue tool developer uses it.
</STRONG></P>
<P><STRONG>
Regards,
<BR>Nick Coleman
</STRONG></P>
<BLOCKQUOTE>
[JimD]
The problems recovering tar files are worst with GNU tar operating on
gzip'd archives. star (by Joerg Schily, of cdrecord and mkisofs fame)
cpio, and pax are all better at resynchronizing to the archive headers
past a point of file corruption than GNU tar.
</BLOCKQUOTE>
<BLOCKQUOTE>
afio might very well be better that cpio. I don't know, I neither run
my own tests nor perused the code.
</BLOCKQUOTE>
<BLOCKQUOTE>
In general I'd suggest that added redundancy (both through ECC --
error correction coding -- and additional separate copies) is the better
way to make one's backups more robust.
</BLOCKQUOTE>
<BLOCKQUOTE>
I've heard that BRU (backup/recovery utility: <A HREF="http://www.tolisgroup.com"
>http://www.tolisgroup.com</A>
a commercial product) adds ECC and checksum data to the archive stream
as it performs backups --- and defaults to verifying the archive
integrity in a second pass over the data. With cpio, afio, tar, star,
dump/restore and pax you have to write your own scripts to perform the
verification pass. (cpio and presumably afio do add checksums, GNU tar
doesn't, I don't know about the others). So far as I know none of the
common free tools adds additional ECC redundancy to their archives.
</BLOCKQUOTE>
<BLOCKQUOTE>
There is an obscure little utility called 'ras' (redundancy archive
system) which can be used to create a set of ECC (sum) files to go
with set of base files and allow one to recover from the loss of a subset
of base files. This is essentially a utility to manually (and crudely)
perform the same sort of redundancy operations as a RAID5 subsystem.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A HREF="http://www.icewalkers.com/Linux/Software/52890/ras.html"
>http://www.icewalkers.com/Linux/Software/52890/ras.html</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
However, I should warn that I haven't used this at all much less tried
to integrate it into any sane backup/recovery scripts!
</BLOCKQUOTE>
<BLOCKQUOTE>
So far the best free backup tool for Linux still seems to be AMANDA
(<A HREF="http://www.amanda.org"
>http://www.amanda.org</A> ) though Bacula (<A HREF="http://www.bacula.org"
>http://www.bacula.org</A> ) seems
to have a similar and impressive feature set.
</BLOCKQUOTE>
<BLOCKQUOTE>
AMANDA still uses native dump and/or GNU tar to actually perform the
backup. It initiates those processes on each client, aggregates their
archives on a central server and manages the process of writing them
out to tapes (optionally using a tape changer).
</BLOCKQUOTE>
<BLOCKQUOTE>
Thus, AMANDA is tape centric and still has the inherent risks of the
underlying archiver (vendor's dump --- dumpe2fs for Linux, or GNU tar).
</BLOCKQUOTE>
<BLOCKQUOTE>
I think it would be neat if AMANDA or Bacula were integrated with
ras or some redundancy library in some meaningful way.
</BLOCKQUOTE>
<BLOCKQUOTE>
There is an overview of these and other free backup packages for UNIX
(and Linux) at:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
<A HREF="http://www.backupcentral.com/free-backup-software2.html"
>http://www.backupcentral.com/free-backup-software2.html</A>
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
Ultimately you'd want to keep multiple generations of data backups even
if you knew that you had perfect ECC, redundancy, media, and drives.
You need this for the same reason you need backups regardless of how
sophisticated and redundant your RAID array is configured. Because you
may find that your software or your users corrupt your data, and you
may need to back off to earlier, known good versions of the data,
possibly days, weeks, even month after those backups were made.
</BLOCKQUOTE>
<BLOCKQUOTE>
(Some forms of corruption can be subtle and insidious).
</BLOCKQUOTE>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">can I have Linux on a ThinkPad G40? with WinXP?</FONT></H3>
Thu, 05 Jun 2003 18:35:32 PST
<BR>borejsza (<a href="mailto:linux-questions-only@ssc.com?cc=linux-questions-only@ssc.com, linux@linux.ucla.edu&cc=borejsza@ucla.edu&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%232">borejsza from ucla.edu</a>)
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
I am about to buy a laptop and am looking for advice as to its
compatibility with Linux.
</STRONG></P>
<P><STRONG>
I know little about computers (last time I owned one it was a Commodore
64), and less about Linux, but saw a friend use it, and would like to
learn how to myself, and gradually move away from Windows. The laptop I
am thinking of buying is an IBM ThinkPad G40
(<A HREF="http://www-132.ibm.com/webapp/wcs/stores/servlet/ProductDisplay?productId=8600909&amp;storeId=1&amp;langId=-1&amp;categoryId=2580117&amp;dualCurrId=73&amp;catalogId=-840"
>http://www-132.ibm.com/webapp/wcs/stores/servlet/ProductDisplay?productId=8600909&amp;storeId=1&amp;langId=-1&amp;categoryId=2580117&amp;dualCurrId=73&amp;catalogId=-840</A>). I think it is a new model, and could not find it anywhere on the
pages that list hardware that has been already tried out with Linux.
</STRONG></P>
<P><STRONG>
Can anybody confirm that I can partition that laptop between Linux and
WindowsXP before I blow all my savings on it?
</STRONG></P>
<P><STRONG>
Thanks,
<BR>Alex
</STRONG></P>
<blockquote><font color="#1F1F1F">You could buy one preloaded from EmperorLinux:
(<A HREF="http://www.emperorlinux.com/auk.html"
>http://www.emperorlinux.com/auk.html</A>)
-- Ben</font></blockquote>
<blockquote><font color="#000066">Or they'll preload a dual boot, or can customize. (So this tip is good
for more than that one model.)
-- Heather</font></blockquote>
<blockquote><font color="#1F1F1F">As far as I'm concerned, IBM-made hardware today should be a sure bet
for Linux anyway: they've really thrown themselves behind Linux in a big
way, and I'd be surprised to hear of a laptop they make that can't run
it. Come to think of it, given the range of hardware that Linux supports
these days, making a 'top that can't run Linux would be quite a trick in
the first place.
-- Ben</font></blockquote>
<BLOCKQUOTE>
[jra]
Now, that's <EM>not</EM> to say that you can <EM>easily</EM> dual-boot XP. There may
be reinstallation issues, and licensing; I don't know that Partition-*
or FIPS can safely resize whatever you have loaded without breaking it,
and you may not have "install" media for XP -- only "recover" media,
which will <EM>not</EM> let you install on a resized partition.
</BLOCKQUOTE>
<blockquote><font color="#1F1F1F">Missing install media for WinXP isn't relevant to its ability to coexist
with Linux, but personally, if my vendor "forgot" to include the Other OS
that I had paid for - I'd demand my real discs, or that they discount the
box the price of their OS. Given the number of people competing for your
business in this venue, I have precious little tolerance for that kind of
ripoff.
-- Ben</font></blockquote>
<BLOCKQUOTE>
[jra]
I would google for "linux win xp dual boot howto", and see what I got.
-- jra
</BLOCKQUOTE>
<BLOCKQUOTE>
[Kapil]
Apparently, the trick is to: (1) Install Linux and resize the NTFS
partition (2) Boot the recovery CD for XP (3) Interrupt (count 5
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">)
the reinstallation process and run "OS.bat". It seems XP will then
"just install" on the resized partition.
</BLOCKQUOTE>
<BLOCKQUOTE>
This worked with the laptops bought for our Institute. YMMV.
</BLOCKQUOTE>
<BLOCKQUOTE>
-- Kapil.
</BLOCKQUOTE>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">FTP Daemons (Servers) and Alternatives: Just Say No?</FONT></H3>
Tue, 3 Jun 2003 06:03:09 -0700
<BR>Jim Dennis (<a href="mailto:linux-questions-only@ssc.com?cc=Blt-newuser@basiclinux.net&cc=jimd@starshine.org&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%233">the <em>LG</em> Answer Guy</a>)
<BR>Question by Dinos Kouroushaklis on the BLT-newuser list (Blt-newuser from basiclinux.net)
<!-- ::
FTP Daemons (Servers) and Alternatives: Just Say No?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Dear list members,
</STRONG></P>
<P><STRONG>
I would like to hear your suggestions for an ftp server.
</STRONG></P>
<P><STRONG>
I would like to replace an existing win2k ftp server with a Linux based one.
What I am interested in is reliability and ease of management.
The machine should need only one (maybe more) ethernet card to provide the
ftp service (except during installation time). The two ethernet cards can
be use
one for management and one for the traffic.
</STRONG></P>
<P><STRONG>
The machine will be an Intel Celeron 400 Mhz with 160 (128+32) and
20 GB hard disk with a public (static) IP address in the DMZ.
</STRONG></P>
<P><STRONG>
Regards
</STRONG></P>
<P>
Just to be contrarian I have to suggest that you seriously consider
abandoning FTP entirely. HTTP is adequate for simple, lightweight
anonymous distribution of files (text or binary). scp, sftp (SSH) and
rsync over ssh are inherently more secure than plain FTP can ever be.
Your MS-Windows users can get Putty (and pscp, et al.) for free.
</P>
<P>
(Plain, standard FTP will, by dint of the standards, always pass user
name and password information "in the clear" across the Internet --- those
exposing these valuable, private tokens to "sniffers"). For some
purposes BitTorrent can be far more efficient (for widespread, peer
assisted distribution of files to many concurrent clients, for
example).
</P>
<P>
SSH, scp, and sftp:
</P>
<P><BLOCKQuote>
<A HREF="http://www.openssh.org"
>http://www.openssh.org</A>
</BLOCKQuote></P>
<P>
Putty:
</P>
<P><BLOCKQuote>
<A HREF="http://www.chiark.greenend.org.uk/~sgtatham/putty"
>http://www.chiark.greenend.org.uk/~sgtatham/putty</A>
</BLOCKQuote></P>
<P>
rsync:
</P>
<P><BLOCKQuote>
<A HREF="http://www.samba.org/rsync"
>http://www.samba.org/rsync</A>
</BLOCKQuote></P>
<P><DL><DT>
BitTorrent:
<DD><A HREF="http://bitconjurer.org/BitTorrent"
>http://bitconjurer.org/BitTorrent</A>
</DL></P>
<P>
If you can, just eliminate FTP and direct your users and customers to
better alternatives.
</P>
<P>
In general the problem with FTP servers is that they run as root
(at least during the authentication phase, if they support <EM>anything</EM>
other than anonymous FTP). So FTP daemons have classically been a
source of vulnerability (as bad as DNS -- BIND/named --- and MTA --
sendmail --- daemons).
</P>
<P>
With that in mind, vsftpd would probably be my first free choice.
(<A HREF="http://vsftpd.beasts.org"
>http://vsftpd.beasts.org</A> )
</P>
<P>
ProFTPd is popular, and has configuration file syntax that's a vaguely
similar to <A HREF="http://www.apache.org/">Apache</A>/HTML/SGML (I'll leave it for others to judge that
a feature or bug). However, ProFTPd is complex and has had too many
security alerts posted against it for my tastes.
(<A HREF="http://www.proftpd.org"
>http://www.proftpd.org</A> ).
</P>
<P>
WU-FTPD (for years the default that shipped with most Linux
distributions) has the worst security track record in the field. I
wouldn't recommend it, I don't care how many bugs they've patched.
There comes a time to abandon the codebase and start from scratch.
There also comes a time when "brand recognition" (the project's name)
shifts from notoriety to notorious infamy.
</P>
<P>
By contrast, Chris Evans coded vsftpd specifically to be as secure as
possible. He discussed the design and every pre-release of the code
extensively on the Linux security auditing mailing list (and in other
fora devoted to secure programming and coding topics).
</P>
<P>
If you're willing to go with a commercial/shareware package (that's not
free) I'd suggest that Mike Gleason's ncftpd has been around longer
than vsftpd and still has a very good track record.
(<A HREF="http://www.ncftpd.com"
>http://www.ncftpd.com</A> ). Registration is only $200 (U.S.) per server
for unlimited concurrent connections ($100 for up to 50 concurrent
users) and is free for use in educational domains.
</P>
<P>
If there are no objections I'd like to cross-post this to the Linux
Gazette for publication (names of querents will be sanitized) since
the question comes up periodically and I like to refresh this answer
and the URLs.
</P>
<P>
All of this assumes that you have no special needs of your FTP server.
If you need special features (directory trees restricted by user/group
info, pluggable authentication support, virtual domain support, etc)
then you'll have to review these products more carefully. However,
each of them offers at least some virtual domain/server functionality
and a mixture of other features.
</P>
<BLOCKQUOTE>
[Dan]
For a comprehensive annotated list, see:
<A HREF="http://linuxmafia.com/pub/linux/security/ftp-daemons"
>http://linuxmafia.com/pub/linux/security/ftp-daemons</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
Everybody's got their favorite, and mine's PURE-ftpd, of which
Rick Moen of Linuxmafia says on the above page:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
Seems like a winner.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
<A HREF="http://sourceforge.net/projects/pureftpd"
>http://sourceforge.net/projects/pureftpd</A>
</BLOCKQUOTE>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.4"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Pause after running xterm</FONT></H3>
Fri, 30 May 2003 20:39:56 -0400
<BR>Ben Okopnik (<a href="mailto:linux-questions-only@ssc.com?cc=ben@callahans.org&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%234">the <em>LG</em> Answer Gang</a>)
<blockquote><font color="#000066">Okay, so it's a nickel's worth. So there.
-- Heather</font></blockquote>
<P>
Here's a little problem you might run into: you want to run a certain
program - say, as a Mozilla "Helper application" - which needs to run in
an xterm. So, you set it up like so:
</P>
<blockquote><pre>xterm -e myprogram -my -options
</pre></blockquote>
<P>
The only problem is, when it comes time to run it, all you see is a
flash as the xterm appears, then immediately disappears. What happened?
What error did it print out? Why (this does happen at times) does it
work when you launch it 'manually' but not from Mozilla?...
</P>
<P>
Here's an easy and useful solution that will require you to hit a key in
order to exit the xterm after the program has finished running. Note
that it may fail on tricky command lines (subshell invocations, evals,
and other shell-specific gadgetry) but should work fine with normal
commands and their options.
</P>
<p align="center">See attached <tt><a href="misc/tips/okopnik.hold.bash.txt">okopnik.hold.bash.txt</a></tt></p>
<P>
Invoke it like so:
</P>
<blockquote><pre>xterm -e hold myprogram -my -options
</pre></blockquote>
<BLOCKQUOTE>
[jra]
Were you actually planning to <EM>answer</EM> those question, Prof?
</BLOCKQUOTE>
<BLOCKQUOTE>
Or are they left as an exercise for the students?
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
The answer is implicit in the solution provided, and will depend on the
specific program being launched. The implementation, as always, <EM>is</EM>
left to the student. Giddyap, dammit.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
</BLOCKQUOTE>
<blockquote><pre> xterm -e /bin/sh 'myprogram -my -options; read x'
</pre></blockquote>
<BLOCKQUOTE>
... in other words, have a shell execute your program, then read a
dummy value from the xterm (the xterm process' console/terminal/stdin)
</BLOCKQUOTE>
<BLOCKQUOTE>
The command will run, output will be displayed, you'll get a pause
where you can type anything you like (also allowing you to scroll
through the xterm's buffer). When you hit [Enter] the xterm goes away.
</BLOCKQUOTE>
<BLOCKQUOTE>
Seems pretty transparent to me. More verbose:
</BLOCKQUOTE>
<blockquote><pre> xterm -e /bin/sh 'myprogram -my -opts; echo "[Enter] when done: ";read x'
</pre></blockquote>
<BLOCKQUOTE>
More elegant, create a two line script:
</BLOCKQUOTE>
<p align="center">See attached <tt><a href="misc/tips/jimd.pauseadter.sh.txt">jimd.pauseadter.sh.txt</a></tt></p>
<BLOCKQUOTE>
(I'm not really sure we need the eval, but I don't think it'll hurt in
any case).
</BLOCKQUOTE>
<BLOCKQUOTE>
Now simply:
</BLOCKQUOTE>
<blockquote><pre> xterm -e pauseafter.sh myprogram -my -opts
</pre></blockquote>
<BLOCKQUOTE>
(<TT>/me</TT> shudders at the electrons that got excited by this blatantly
obvious suggestion).
</BLOCKQUOTE>
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.5"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Tips on PDF conversion</FONT></H3>
Thu, 12 Jun 2003 12:12:55 +0100 (BST)
<BR>Mike Martin (<a href="mailto:linux-questions-only@ssc.com?cc=redtuxxx@yahoo.co.uk&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%235">the <em>LG</em> Answer Gang</a>)
<P><STRONG>
Has anyone any ideas on converting PDF's to decent text.
</STRONG></P>
<P><STRONG>
To explain
</STRONG></P>
<P><STRONG>
I have a document which has been scanned in, with the only accurate
conversion being to pdf (no images)
</STRONG></P>
<P><STRONG>
So I have used pdf2ps which gives me ps file.
</STRONG></P>
<P><STRONG>
However then when I use psto... anything text like, the output is
exactly ^L
</STRONG></P>
<P><STRONG>
Any ideas/tips?
</STRONG></P>
<BLOCKQUOTE>
[Thomas]
If you could convert the pdf to ps and then to LateX then you won't have a
problem since tex -&gt; ascii is not a problem. However, going from ps to
ascii might require some more thought.
</BLOCKQUOTE>
<BLOCKQUOTE>
I know that there is a utility called "a2ps" which takes ascii and
converts it to a ps file, however I cannot see a converse one program.
</BLOCKQUOTE>
<BLOCKQUOTE>
I am sure that there is a perl module (hey, Ben!) that could be used to
write a perl-script for such a task, however, I am going to suggest you
try the following......(I haven't tested this):
</BLOCKQUOTE>
<blockquote><pre>strings ./the_ps_file.ps | col -b &gt; ~/new_text_file.txt
</pre></blockquote>
<BLOCKQUOTE>
I am shunting this through "col" since you describe having lots of "^L"
characters. You might have to edit the file by hand as well, since I am
sure that a lot of useless information is being processed.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
See the "pstotext" utility for that.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Andreas]
There's a utility called pdftotext, it is in the xpdf Package, see the
xpdf-Homepage
<A HREF="http://www.foolabs.com/xpdf"
>http://www.foolabs.com/xpdf</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
Hopefully an OCR has been performed on your scanned document before it
was converted to pdf, otherwise the pdf file would just contain an image
and could not directly be converted to text.
</BLOCKQUOTE>
<P><STRONG>
Unfortunately, and very annoyingly this is what seems to have
happened, seriously aggravating software - it lies.
</STRONG></P>
<P><STRONG>
Off to to see if I can work out how to convert the image to text (its
only tables)
</STRONG></P>
<BLOCKQUOTE>
[Ben]
Well, if it's a picture, "pstotext" won't help. Oh, and don't
bother with "strings" on a .ps file: it's <EM>all</EM> text.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Robos]
Hmm, I ran into some ocr discussion lately and found this: gocr and claraorc
(<A HREF="http://www.claraocr.org"
>http://www.claraocr.org</A>). The latter one seems to be more evolved...
</BLOCKQUOTE>
<!-- end 5 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.6"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">quotas on directories?</FONT></H3>
Tue, 3 Jun 2003 19:55:26 +0200
<BR>Emmanuel Damons (<a href="mailto:linux-questions-only@ssc.com?cc=emmanuel.damons@enterpriseig.com&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%236">emmanuel.damons from enterpriseig.com</a>)
<br>Answered By Thomas Adma, Jim Dennis, Kapil Hari Paranjape
<P>
Hi
</P>
<P>
Can you help me I need to specify the size that a folder can grow.
almost like the quotas for folder and not users
</P>
<P>
Thanks
</P>
<BLOCKQUOTE>
[K.-H.]
spontaneous idea, especially if this is for one folder only:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
create a partiton of exactly right size and mount it at mountpoint "folder".
If creating a partition is not possible use a file and mount it a loop device.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
In the same concept you could use regular files with the loop mount
option to create "partitions" of this sort.
</BLOCKQUOTE>
<BLOCKQUOTE>
Example:
</BLOCKQUOTE>
<blockquote><pre> dd if=/dev/zero of=/mnt/images/$FOLDERNAME bs=1024 count=$SIZE
mkfs -F /mntimages/$FOLDERNAME
mount -o loop /mntimages/$FOLDERNAME $TARGET
</pre></blockquote>
<BLOCKQUOTE>
Where:
</BLOCKQUOTE>
<blockquote><pre> FOLDERNAME is an arbitrary filename used as a "loopback image"
(the container that the loop block device driver will treat
as if it were a partition)
SIZE is the desired size in kilobytes
TARGET is the desired location of the "folder" (the mountpoint for
this filesystem).
</pre></blockquote>
<BLOCKQUOTE>
You can use any of the Linux supported filesystem types (ext2, ext3,
minix, XFS, JFS, ReiserFS) and you can tune various options (like
the amount of reserved space on such "folders" and which UID/GID
(user or group) that space is reserved for. You should be able to
use quotas, ACLs and EAs (extended attributes and access control lists)
(assuming you've patched your kernel for ACL/EA use and enabled it)
etc.
</BLOCKQUOTE>
<BLOCKQUOTE>
Obviously this approach as a couple of downsides. You need
intervention by root (or some sudo or SUID helpers) to create and
use these images.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Kapil]
Of course, you can use User-mode-linux to create and use these images.
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
Also Linux can only support a limited number of
concurrent loop mounts (8 by default). Newer kernels allow this as
a module parameter (max_loop=&lt;1-255&gt; ... so up to 255 such folders
maximum on the system). This limits the number that could be in
concurrent use (though an unlimited number of these "folders" could
be stored on the system, mounted and unmounted as needed).
</BLOCKQUOTE>
<BLOCKQUOTE>
There might be other disadvantages in performance and overhead (I'm not
sure).
</BLOCKQUOTE>
<BLOCKQUOTE>
[Kapil]
That would be a downside with UML if you use the file systems with UML.
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
On the plus side you could have any of these encrypted, if you're
running a kernel that's had the "International crypto" patch applied to
it; and you pass the appropriate additional options to the mount
command(s). We won't address the key management issues inherent in
this approach; suffice it to say that almost forces us to make mounting
these filesystems an interactive process.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you wanted to have a large number of these, but didn't need them all
concurrently mounted you might be able to configure autofs or amd
(automounters) to dynamically mount them up and umount them as the
target directories were accessed --- possibly by people logging in and
out.
</BLOCKQUOTE>
<BLOCKQUOTE>
There are probably better ways, but this seems to be the most obvious
and easiest under Linux using existing tools.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Kapil]
One solution (rather complicated I admit) is to switch over to the Hurd
which allows such things and more complicated things as well.
</BLOCKQUOTE>
<BLOCKQUOTE>
Another is to use "lufs" or other "Usermode filesystems". These put
hooks in the kernel VFS that allow one to set up a "user mode" program
to provide the "view" of the part of VFS that lies below a particular
directory entry.
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
The very notion of limiting the size of a "directory tree" (folder)
is ambiguous and moot given the design of UNIX. Files don't exist
"under" directories in UNIX. Files are bound to inodes which are
on filesystems. Filenames are links to inodes. However every inode
can have many links (names). Thus there's an inherent abiguity of
what it means to take up space "in a folder" (or "under a directory").
You could traverse the directory tree adding up all files (and the
sizes of all directories) thereunder (du -s). This works fine for all
inodes with a link count of one, and for cases where all of the inodes
are within the scope of the tree (and assuming there are no mount
points thereunder). However, it's ambiguous in the general case and
begs the question: just what are you trying to accomplish.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Kapil]
Excellent explanation Jim.
</BLOCKQUOTE>
<!-- end 6 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.7"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">What is Reverse DNS?</FONT></H3>
Mon, 2 Jun 2003 20:37:46 EDT
<BR> (<a href="mailto:linux-questions-only@ssc.com?cc=TEEML914@aol.com&cc=jimd@mars.starshine.org&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%237">jimd from mars.starshine.org</a>)
<BR>Question by TEEML914 (TEEML914 from aol.com)
<P><STRONG>
I'm doing an assigment. Can you tell me in laymans terms what reverse DNS is?
</STRONG></P>
<BLOCKQUOTE>
[Faber]
Yes, we can.
</BLOCKQUOTE>
<P><STRONG>
Thank you and have a great day
</STRONG></P>
<BLOCKQUOTE>
[Faber]
You're welcome and have a spiffy night yourself..
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
Faber, I think your cheerful sarcasm might be lost on him. After,
he's dense enought to take such a simple question (from his homework
assigment, no less) and go to all the trouble it of asking <EM>us</EM>
</BLOCKQUOTE>
<BLOCKQUOTE>
Yes, we can tell you. We can answer such questions. With dilligent
work (as in DOING YOUR OWN HOMEWORK) you'd be able to answer questions
like that, too.
</BLOCKQUOTE>
<BLOCKQUOTE>
For everyone else who hears this buzz phrase and wonders about it
(people who aren't trying to skate through classes so they can make
complete idiots of themselves when they enter a job market thoroughly
unprepared by the schooling they shirked):
</BLOCKQUOTE>
<TABLE WIDTH="95%" BORDER="1" BGCOLOR="#FFFFCC"><TR><TD>
<p align="center">...............</p>
<BLOCKQUOTE><BLOCKQuote>
"reverse DNS" is the process of asking the DNS (domain name system)
for the name associated with a given IP address (which, of course, is
numeric). Since DNS is primarily used to resolve (look up) an
address given a name; this numeric to symbolic lookup is the
converse operation. However, the term "converse" is somewhat obscure
so the more literate and erudite among us are stuck with the phrase:
"reverse DNS."
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
On a technical level, a reverse DNS query is a question for a PTR
record in the in-addr.arpa domain. For historical reasons the
in-addr (inverse address) subdomain of the "Advanced Research
Projects Administration" (the forebear of the Internet) is reserved
for this purpose. For technical reasons the four components of a
traditional "dotted quad decimal" representation of the address are
arranged in reverse order: least significant octet first. This
allows the most significant octets to be treated as "subdomains" of
the in-addr.arpa domain which allows delegation (a DNS mechanism for
administrative and routing/distribution purposes) to be down on
octet boundaries.
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course any good book on DNS will provide all of the gory details,
or one could simply read the RFCs (request for comments documents)
which are the normal mechanism by which standards are proposed to the
IETF (Internet Engineering Task Force) which marshalls them through a
review and vetting process, publishes them and recommends their
adoption. (Since the Internet is still basically anarchial the
adoption of new standards is essentially a ratification process ---
each Internet site "votes with its feet" as it were).
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
In particular it looks like you'd want to read RFC3172:
<DD><A HREF="http://www.faqs.org/rfcs/rfc3172.html"
>http://www.faqs.org/rfcs/rfc3172.html</A>
</DL></BLOCKQUOTE><p align="center">...............</p>
</TD></TR></TABLE>
<BLOCKQUOTE>
Please have your instructor send my extra credit points c/o Linux
Gazette and be sure to have him give you a failing grade in your TCP/IP
or Internet/Networking Fundamentals class.
</BLOCKQUOTE>
<BLOCKQUOTE>
(In the unlikely event the assignment was to explore the use of sarcasm
by curmudgeons in the Linux community --- then bravo!)
</BLOCKQUOTE>
<!-- end 7 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.8"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Subscribe to groups...........pan,Knode.......????</FONT></H3>
Wed, 25 Jun 2003 20:21:12 +0530
<BR>Vivek Ravindranath (<a href="mailto:linux-questions-only@ssc.com?cc=vivek_ravindranath@softhome.net&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%238">vivek_ravindranath from softhome.net</a>)
<br>Answered By Dan Wilder, Karl-Heinz Herrmann, Anita Lewis, Ben Okopnik, Jason Creighton, Heather Stern
<P><STRONG>
Hi Answer Gang,
</STRONG></P>
<P><STRONG>
Can please tell me how to subscribe to linux groups
</STRONG></P>
<BLOCKQUOTE>
[Dan]
You might start by pointing your browser (konqueror, mozilla,
lynx, w3m, netscape, and so on) at:
</BLOCKQUOTE>
<blockquote><pre>http://www.tldp.org
</pre></blockquote>
<BLOCKQUOTE>
and browse what's there. Then look at
</BLOCKQUOTE>
<blockquote><pre>http://www.linuxjournal.com
http://www.linuxgazette.com
http://www.lwn.com
http://www.linuxtoday.com
http://www.slashdot.com
</pre></blockquote>
<BLOCKQUOTE>
Then you might come back and explain in somewhat more specific
terms what you're trying to do. There are lots of Linux websites,
including documentation, news, online discussions; to get to any of
those, you just click on links.
</BLOCKQUOTE>
<BLOCKQUOTE>
For e-mail discussion groups you mostly have to subscribe. How you
do that depends on what group you're interested in. Once you're
subscribed, any email you send to some submission address is duplicated
and sent to all subscribers.
</BLOCKQUOTE>
<BLOCKQUOTE>
Many discussion groups have their archives open. For example, point
your browser at
</BLOCKQUOTE>
<blockquote><pre>http://www.ssc.com/mailing-lists
</pre></blockquote>
<BLOCKQUOTE>
for an overview of mailing lists hosted by SSC, publishers of Linux Journal.
</BLOCKQUOTE>
<BLOCKQUOTE>
From that page you can click on list information pages and get to list
</BLOCKQUOTE>
<BLOCKQUOTE>
archives by following the links. The list information pages also let
you apply for membership in the lists. Normally you'll get a confirming
email back, and your list membership goes into effect when the list
management software receives your reply.
</BLOCKQUOTE>
<P><STRONG>
such yahoo groups ,
</STRONG></P>
<BLOCKQUOTE>
[Jason]
Well, "Yahoo groups" are just email lists, so you can subscribe to them and
read them offline. Same deal for any mailing list.
</BLOCKQUOTE>
<P><STRONG>
google groups .......
</STRONG></P>
<BLOCKQUOTE>
[Jason]
Now for newsgroups (What you call "google groups". Google groups is actually a
web interface on top of usenet.) I use leafnode (Sorry, don't have the URL,
but a google for "leafnode usenet server" would probaby turn up the homepage.)
for this. It's an easy to configure (IMHO) usenet server that only downloads
messages in groups that you read.
</BLOCKQUOTE>
<P><STRONG>
and download all messages for offline viewing using pan or
knode or any other software (Please mention the name of the software and
URL).I wan't to view the messages offline.
</STRONG></P>
<P><STRONG>
First of all I dont know whether it is possible.Can you suggest any other
methods to do so? By groups I mean any linux group, please suggest any good
linux groups if possible...and please give the address that is to be entered
in the address field of the viewer and other details.I just want to get
regular information regarding linux........thanks in advance.
</STRONG></P>
<P><STRONG>
Vivek.
</STRONG></P>
<BLOCKQUOTE>
[K.-H.]
for the offline reading: I'm not quite sure what "linux group" you are
talking about. If you want to have a look at linux websites as suggested
wwoffle is very useful for caching of webpages so you can view them at
leasure offline. Any new link you click on will be remembered and fetched
next time online. If you talk about news groups (usenet) like:
comp.os.linux.* I am using [x]emacs newsreader "gnus" which has a offline
feature called "agent". You can read the info pages to this but if this is
your first contact with news and [x]emacs then I can not recommend this
wholeheartedly -- gnus itself is rather complex and therefor powerful (or is
it the other way round?). Agent is an additional layer of complexity which
takes time to get used to.
</BLOCKQUOTE>
<BLOCKQUOTE>
pan I don't know,
</BLOCKQUOTE>
<blockquote><font color="#000066">It's a newsreader, whose name might offend a family publication, but
which is nonetheless supposed to be very nifty.
-- Heather</font></blockquote>
<BLOCKQUOTE>
knode I can only guess is the kde version of a newsreader.
If they support offline features I've no idea. There are other newsreaders:
nn, tin, ... but as far as I know all miss the offline feature. netscape has
a newsreader with rather limited offline capabilities but for a first try
that might be sufficient.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Anita]
Do you mean that you would subscribe to a mailing list on yahoogroups and
then go there and download their archives? That is something I would like
to know how to do too, because we had a list there and changed to our own
server. I'd like to be able to get those old messages. Well, in truth, I
would have liked to have had them, but now I think they are too obsolete.
Still, I wouldn't mind having them, especially if I could get them into mbox
format.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Faber]
&lt;musing out loud&gt;Couldn't you use something like wget in a Perl script
to download the archives by links? Ben could probably write a one-liner
to do it. In his sleep.
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
&lt;/musing&gt;
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Actually, it would take some tricky negotiation, Web page downloading
and parsing, etc. - it's a non-trivial task if you wanted to do it from
scratch. "Yosucker" from <A HREF="http://www.freshmeat.net/">Freshmeat</A> is a good example of how to download
their Web-only mail; it wouldn't be too hard to tweak for the above
purpose (it's written in Perl.)
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason]
You could probably just use wget, with some combination of -I and -r. The
thing is a HTTP/FTP shotgun.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Nope. Remember that you need to log in to Yahoo before you can read the
stuff; after that, you get to click on the message links (20 per page or
so) to read them. If it was that easy, they wouldn't be able to charge
you for the "improved" access (which includes POP access to your mail
and a bunch of other goodies.)
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason]
Actually, I was thinking of download from an online mailing list archive, not
logging into Yahoo.
</BLOCKQUOTE>
<blockquote><font color="#000066">Perhaps a little specific encoding with lynx' ability to pick up its
transmission data from stdin ... -get_data. It's <EM>your</EM> login, so
you'll need to guard your password in that packet from prying eyes.
Like Ben says, tricky, but certainly it can be done.
-- Heather</font></blockquote>
<!-- end 8 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.9"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Confused about symantics of "mount -o,async/sync" commands</FONT></H3>
Thu, 12 Jun 2003 21:30:21 -0700
<BR>Bombardier System Consulting (<a href="mailto:linux-questions-only@ssc.com?cc=bombardiersysco@qwest.net&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%239">bombardiersysco from qwest.net</a>)
<br>Answered By Karl-Heinz Herrmann, Thomas Adam, Ben Okopnik, Jim Dennis, Jay R. Ashworth
<P><STRONG>
Hello,
</STRONG></P>
<P><STRONG>
I am taking a local Linux certification class and seem to have offended my
instructor by questioning the semantics of the "sync" and "async" options in
the mount command. They seem backward to me and I don't understand what I
am missing.
</STRONG></P>
<P><STRONG>
The following are the definitions that I found online and understand for the
words:
</STRONG></P>
<P><STRONG><BLOCKQuote>
Synchronous (pronounced SIHN-kro-nuhs, from Greek syn-, meaning "with," and
chronos, meaning "time") is an adjective describing objects or events that
are coordinated in time. (within the context of system activities I
associate synchronous with either being timing based or requiring an
acknowledgement)
</BLOCKQuote></STRONG></P>
<P><STRONG>
Asynchronous (pronounced ay-SIHN- kro-nuhs, from Greek asyn-, meaning "not
with," and chronos, meaning "time") is an adjective describing objects or
events that are not coordinated in time. (within the context of system
activities I associate asynchronous with being event/interrupt driven).
</STRONG></P>
<P><STRONG>
It has been my experience and is my understanding with disk caching that
data that is released to the system to be written to disk is kept for a
specific time or until the cache is full before being written to disk.
Hence synchronous. It is my experience and is my understanding that data
from an application which is released to the system and is directly written
through to disk is done so in an asynchronous or event driven manner.
</STRONG></P>
<BLOCKQUOTE>
[K.-H.]
synchronous -- applications intent to write data and actual write are at the
same time
</BLOCKQUOTE>
<BLOCKQUOTE>
asynchronous -- applications intent to write and actual write are not at the
same time as system decides when to write the cached data
</BLOCKQUOTE>
<BLOCKQUOTE>
[Thomas]
These options are really useful in <TT>/etc/export</TT> if you ever need to mount
directories over NFS, too. Although just don't specify them at the same
time as each other!
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Yup. The latter is more efficient, since it allows the hevy lifting to
occur all at once (one way to look at it is that the "startup" and the
"wind-down" costs of multiple disk writes are eliminated - you "pay"
only once), but is a little less secure in the sense of data safety -
if your computer is, say, accidentally powered down while there's data
in the cache, that data evaporates, even though you "know" that you
saved it.
</BLOCKQUOTE>
<P><STRONG>
This is evidently opposite of the way that the terms are understood and used
in Linux. Please help me understand.
</STRONG></P>
<P><STRONG>
Thanks,
</STRONG></P>
<P><STRONG>
Jim Bombardier
</STRONG></P>
<BLOCKQUOTE>
Put simply, ... you're wrong.
</BLOCKQUOTE>
<BLOCKQUOTE>
"sync" in the Linux parlance (and in other disk buffering/caching contexts
with which I'm familiar) means that the writes to that filesystem are
"synchronized" out to the disk before the writing process is scheduled
for any more time slices. In other words, upon return from a <TT> write()</TT>
system call the write as occurred to the hardware device.
</BLOCKQUOTE>
<BLOCKQUOTE>
This usage is consistent with the traditional meaning of the 'sync'
utility (part of all versions of UNIX I've used and heard of). The
'sync' utility forces the kernel to "synchronize" its buffers/caches
out to the device.
</BLOCKQUOTE>
<BLOCKQUOTE>
"async" means that writes are happening asynchronously to the ongoing
events in the process. In other words mere return from the function
call doesn't indicate that the data is safely flushed to the device.
</BLOCKQUOTE>
<BLOCKQUOTE>
Note that use of sync is strongly discouraged by kernel luminaries
(Linus Torvalds in particular). I sometimes choose to over-ride their
better judgement myself --- but I do so only with considerable mulling
on the tradeoffs. In general you're better off with UPS
(uninterruptable power supply) and a journaling filesystem than you'll
ever be by trying to force synchronous writes for an entire filesystem.
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course, with open source packages you can opt for aggressive explicit
synchonization of selected file descriptors using the <TT> fsync()</TT> function.
Note that this can lead to poor overall system performance in some
cases. For example MTAs (mail transport agents) and syslogd both make
extensive use of <TT> fsync()</TT>. If they share the same filesystem (<TT>/var/log</TT>
and <TT>/var/spool</TT> are on a single volume) it can make the entire system
feel sluggish under only moderate mail handling load (as each mail
delivery logs several messages and each of those processes runs
its on <TT> fsync()</TT> calls.
</BLOCKQUOTE>
<BLOCKQUOTE>
[jra]
You know, the way I've always interpreted this is that it describes the
coupling between the application program's logical view of the disk
contents and the actual physical, magnetic contents of the drive,
across time:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
those views are either mandated to stay in "sync" -- no buffering; if
the OS says it's written, it is <EM>on the platters</EM>, or they're "async"
-- the OS is permitted to "cheat" a little bit in between when it tells
the <EM>app</EM> "it's written" and when it actually happens.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
I guess it's really just another way of phrasing the same thing...
</BLOCKQUOTE>
<!-- end 9 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.10"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Linux Journal Weekly News Notes - Tech Tips</FONT></H3>
Mon, 23 Jun 2003 01:29:49 -0700
<BR>Linux Journal News Notes (<a href="mailto:linux-questions-only@ssc.com?cc=lj-announce@ssc.com&subject=%20Re%3A%20%5BLG%2092%5D%202c%20Tips%20%2310">lj-announce from ssc.com</a>)
<h4 align="center"><br>Cut Them Off At The Pass
</h4>
<P>
If someone's script is going haywire and making too many connections
to your system, simply do:
</P>
<P><CODE>
route add -host [hostname]
</CODE></P>
<P>
...to keep the offending box from shutting yours down entirely.
</P>
<HR width="10%" align="center">
<h4 align="center"><br>Log A Lot Less
</h4>
<P>
You can turn off syslogd's MARK lines by invoking them with -m 0. You
can put this invocation in the init script that starts syslogd. This
is especially useful on laptops to keep them from spinning up the hard
drive unnecessarily.
</P>
<HR width="10%" align="center">
<h4 align="center"><br>Watch a Bit More
</h4>
<P>
Using the watch command, you automatically can run the same command
over and over and see what changes. With the -d option, watch
highlights the differences. Try it with watch -d ifconfig.
</P>
<HR width="10%" align="center">
<h4 align="center"><br>Rooting Around with LILO
</h4>
<P>
If you are working from a rescue disk with your normal root partition
mounted as <TT>/mnt/root</TT>, you can reinstall the LILO boot sector from your
<TT>/etc/lilo.conf</TT> file with lilo -r <TT>/mnt/root.</TT> This tells LILO(
<IMG SRC="../gx/dennis/smily.gif" ALT="8)"
height="24" width="20" align="middle"> to
chroot to the specified directory before taking action. This command
is handy for when you install a new kernel, forget to run LILO and
have to boot from a rescue disk.
</P>
<HR width="10%" align="center">
<h4 align="center"><br>Removing Files Starting With Dashes
</h4>
<P>
If you want to remove a file called -rf, simply type rm -- -rf. The --
tells rm that everything after -- is a filename, not an option.
</P>
<blockquote><font color="#000066">The LG staff note that ./ (dot slash) preceding the offending filename
is effective too, and works even on older versions of rm - or non linux
systems - that may not have this handy option.
-- Heather</font></blockquote>
<HR width="10%" align="center">
<h4 align="center"><br>Any Program Can Learn To Read
</h4>
<P>
If you have a program that reads only from a file and not from
standard input, no problem. The <TT>/proc</TT> filesystem contains a fake file
to pass such programs their standard input. Use <TT>/proc/self/fd/0.</TT>
</P>
<!-- end 10 -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
<h5>This page edited and maintained by the Editors of <I>Linux Gazette</I><br>HTML script maintained by <A HREF="mailto:star@starshine.org">Heather Stern</a> of Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
<br>Copyright &copy; 2003
<br>Copying license <A HREF="http://www.linuxgazette.com/copying.html">http://www.linuxgazette.com/copying.html</A>
<BR>Published in Issue 92 of <i>Linux Gazette</i>, July 2003</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<!--startcut ==========================================================-->
<CENTER>
<!-- *** BEGIN navbar *** -->
<A HREF="lg_mail.html">&lt;&lt;&nbsp;Prev</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="index.html">TOC</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../index.html">Front Page</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue92/lg_tips.html">Talkback</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../faq/index.html">FAQ</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="lg_answer.html">Next&nbsp;&gt;&gt;</A>
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->