Yup, I finally got all of this together! :-)
Thanks to all for their patience. I'm sorry that this took so long to organize. I've put the entire set of file together in a tar-gzip'ed format together with a short README. These pages are intended for free usage for any personal, educational, or non-commercial purpose. If that's you, then enjoy! Anyone wanting to use these for commercial purposes just needs to drop me a note and let me know what you'd like to use them for. See the copying.html document above.
My sincerest thanks to the folks at RedHat Commercial Linux and The Linux Journal/SSC who have graciously offered the use of their ftp services! You'll find ftp'able copies of the Linux Gazette pages at the following URL's:
Also, if anyone's interested in mirroring the Linux Gazette pages, there's a very short README included for that. Basically, I'd be delighted to have these pages mirrored and made as accessible as possible. All I ask is that you let me know that you're doing this, send me the URL for your pages, and an email address for the person taking care of them. I'll put together a page of mirror sites so that folks can find a site closest to them. Check the mirror.README for more details.
The Linux Gazette files are now available in their entirety on Pacific HiTech's monthly "Linux Archive Monthly CD-ROM".
For those of you who haven't heard of this, it's a monthly CD-ROM put out by Pacific HiTech that contains a boatload of the latest Linux related programs and files culled from the Internet. For example, the January edition included:
If you're interested in this kind of offering, give PHT a call at:
+1-800-765-8369
or, +1-801-261-1024
FAX: +1-801-261-0310
So... does this mean that the 'Gazette is going commercial?
Nope.
But, let me quickly add that, as you've all probably noticed, I believe that a strong commercial base is beneficial to the Linux community. I heartily support and encourage the efforts of such folks as Pacific HiTech, RedHat Commercial Linux, the Linux Journal and SSC, and O'Reilly publishers. These enterprises provide valuable services and offerings at VERY competitive rates, and many of them contribute a portion of their profits back into the non-commercial Linux development efforts.
Ok, sermon over. :-)
Have a look and enjoy!
Yup, that's right... I've decided for sanity's sake, to do a bit of renaming here. As of the beginning of this year, the Linux Gazette will be put out by issue, rather than by month. The reason for this is pretty obvious: I'm back in school and things look busy this semester. I honestly can't commit to putting these pages out on a monthly basis.
I'm very much indebted to all those who've written and sent material to be included in the 'Gazette. It helps a LOT and I want to thank these folks once again. However, it still takes a good deal of time to update pages, edit the material sent, and coordinate all that goes into each issue.
So...
I'll make every effort to get something out each month but I definitely can't promise that this will happen. Thanks again for your patience and understanding! Also, you'll notice that I've changed the 'Gazette's main "Table of Contents" page a bit. The father of a child with ADDH (Attention Deficit Disorder / Hyperactivity) wrote and mentioned that this came across as demeaning to those with this condition. I had ADDH as a child and admit that I occasionally tease about this, having struggled with it myself. I want to publically apologize to all for this. I admit that it was inappropriate and in poor taste. My fundamental intention with the Linux Gazette is to provide a means of communicating ideas in a way that makes using Linux more fun, and NOT to insult or demean anyone. So, once again I appreciate your patience and understanding, AND I appreciate your letting me know when I get out of line...
Having said that, let me finish by saying that I hope you really enjoy this month's (oops...! er, this current issue :-) of the 'Gazette. A lot of folks have written in and there's a lot of great reading here! I must admit that I've learned a good deal from all the things that people have written and I hope that you do too. At the risk of sounding like a broken record, let me encourage you to drop the author(s) of these articles a note and let them know what you think! As I mentioned before, the 'Gazette is intended to encourage the free exchange of ideas and so I welcome any comments, suggestions, improvements, or followups that you feel might help.
Thanks for dropping in!
Enjoy!
--John
Well, howdy! :-)
Happy 1996! I had a nice, albeit event-filled, Christmas break and am now glad to be back in school and starting a new semester. I wanted, once again, to say a very heart-felt "thanks!" to everyone that took the time to write. I know that y'all are pretty busy and I appreciate the time that many of you took out of busy schedules to write.
I've tried to include a number of interesting and informative letters below. Since my mailbox, at last count, has ballooned to 700+ messages over the past couple months, I can't squeeze all your messages in here :-) although I've tried hard to drop everyone at least a short note of thanks.
Let me encourage you to read these things!
Seriously.
There are a LOT of quick tips and excellent ideas here. I haven't set up a "mailto:" for each person that wrote, but if you find something useful then by all means drop that person a note and let them know about it. Most of all...
Enjoy!
John
Kevin Pearson
Date: Sat, 06 Jan 1996 18:54:10 CST
From: Kevin Pearson <adonis2@localnet.com>
Subject: African American Pioneer Link
On Jan. 1st, was the release of the two newest Black Educational Video. The name of the program is called: "A Salute to Our Black Pioneers" - Profife: Dr. Charles R. Drew, Credited with saving thousands of lives daily due to his invention of plasma * and * Profile: Frederick M. Jones, invented the first refrigeration unit for long haul trucks.
We at Adonis are creating our home page at this time. We are let everyone one know about our company, which is producing Black Educational video programs. We would like to use your like address so that others can link up to your services. Also we would like our infomation be part of your information home page. If you can get back to me and see what we can do. Thank you. Kevin Pearson, President Adonis Productions
P.S. Our Home Page will be online on Martin Luther Kings Birthday
-- ÐÏà¡
Jeremy Laidman
Date: Sat, 23 Dec 1995 22:56:45 CST
From: Jeremy Laidman <JPLaidman@ACSLink.net.au>
Subject: Another user for setterm
John
I hope you find this useful enough to include in the Gazette.
This is something I use in my Unix profiles to guide my eyes to previous command lines. By highlighting the prompt I can quickly tell where output from a command ends and my keystrokes begin.
For a bash shell, in my .profile I have:
export PS1="\[`setterm -foreground green`\]\[`setterm -bold on`\]\h:\w\\$\[`setterm -default`\] "
My prompt appears as:
hostname:/current/dir$
with the whole prompt a bright green (looks OK on a black screen). If I'm logged in as root, the $ becomes #. For more info on bash-isms, check out the bash man page. I use variants of this technique under other shells and on other versions of UNIX (see example below).
Some explanation for the curious:
The brackets \[ and \] are required to inform bash of escape sequences (as generated by setterm. Otherwise, command-lines that extend to multiple lines will not wrap quite right after a bit of editing.
Note the extra backslash escaping the $. It won't show as # for root without it. I could have enclosed the whole string in single quotes, and not had to use the extra bashslash, but this delays the execution of the 'setterm' commands to when the prompt is displayed (can be useful) rather than when it is set.
For systems without setterm, but with terminfo capabilities, use tput, replacing `setterm -foreground green` with `tput bold`, and `setterm -default` with `tput sgr0`.
For non-bash shells, the brackets \[ and \] for escape-sequences are not needed. For a non-Linux korn-shell (ksh) account I have, I use:
export PS1="`tput bold``hostname`:\$PWD$`tput sgr0` "
This does everything except show # for root.
Congratulations on a fab publication. Most helpful. I like the quick tips idea. So much that makes more Linux useful for me has been shown to me by fellow Linuxers who just discovering things accidentally. Ideal snippets for such a publication.
Cheers
--------------------------------------------------------------------- Jeremy Laidman, Internet/Netware Contractor JPLaidman@ACSLink.net.au Canberra, Australian Capital Territory Phone: (61 6) 241 7969 (ah)
Simon Arthur
Date: Sat, 02 Dec 1995 00:07:33 CST
From: Chroma <chroma@mindspring.com>
Subject: FvwmWinList modification
I thought you might be interested in a cool modification I made to FvwmWinList.
I made a simple change to FvwmWinList for my own use. To make it more like the Windows 95 taskbar, I modified ButtonArray.c
In function DoButton, I changed the line
XDrawString(dpy,win,graph,x+newx,y+3+ButtonFont->ascent,ptr->title,strlen(ptr->title)); to read XDrawString(dpy,win,graph,x+2,y+3+ButtonFont->ascent,ptr->title,strlen(ptr->title));
This removes the centering. I find this works much better if you have FvwmWinList on the left side of the screen as it lets you see the name of the window even if FvwmWinList is partially covered.
Here's what I have in my .fvwmrc:
*FvwmWinListBack #908090 *FvwmWinListFore Black *FvwmWinListFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-* *FvwmWinListAction Click1 Iconify -1,Focus *FvwmWinListAction Click2 Iconify *FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent *FvwmWinListUseSkipList *FvwmWinListGeometry +3-48 Function "InitFunction" Module "I" FvwmWinList
---------------------------------------------------------------------------- Simon Arthur chroma@mindspring.com https://www.mindspring.com/~chroma/home.html hypemaster@hyper-g.com https://www.mindspring.com/~chroma/hgc/hgc-home.html
Tim Newsome
Date: Fri, 29 Dec 1995 09:38:00 CST
From: Tim Newsome <drz@cybercomm.net>
Subject: RE: Linux Gazette
On Thu, 28 Dec 1995, John M. Fisk wrote:
> >Dunno if the following is in one of the issues I haven't read yet, but here > >goes. To have a background picture for X put the following at the end of your > >xinitrc: > >xv +root -rmode 5 background.gif -quit & > >I can't remember what the -rmode 5 means. Probably centered in the screen. > >Neat thing, anyway. > Thanks for the tip! I've actually run across this and played with > wallpapering the root window using xv -- very cool! Definitely ought > to mention this.As for tips, I wrote this shell-script a while ago:
#!/bin/sh TMP=/tmp/$$_ MAXLENGTH=1000 for logfile; do tail -$MAXLENGTH $logfile > $TMP # Don't use mv to keep the permissions the same. cat $TMP > $logfile rm -f $TMP done
It simple goes through all the logfiles you specify on the commandline and trims them to a 1000 lines. (Nothing really useful, just another 2c one. I actually like the 2c tips a lot.)
> and your taking the time to write. Hope you had a merry Christmas -- > have a Happy New Year!
Same to you!
Tim
Tim Newsome. drz@cybercomm.net. https://www.cybercomm.net/~drz/. HotJava rules. Pretending to work is almost as hard as the real thing. Linux > Windows. question=(be||!be); answer=42; hack!=crack; IRC=fun; cogite ergo rideo. 1+1=3 for large values of 1. CMU here I come! NO CARRIER
Kurt M. Hockenbury
Date: Fri, 08 Dec 1995 21:55:01 CST
From: Kurt M. Hockenbury <kmh@linux.stevens-tech.edu>
Subject: Linux Gazette syslog tip
In the November issue, you meantion syslog.conf. Here's a quick tip: I have a line at the end of my /etc/syslog.conf which reads
# Throw everything on tty8 as well *.* /dev/tty8
This way, I also get a copy of *every* syslog entry on Virtual Console 8 (which I don't otherwise use - no getty running on it, etc). You can use any unused console you want.
It's handier than having to tail the various logging files, and cheaper on memory than running a "tail -f" under some shell, and uses no extra disk space.
When my hard disk makes swapping noises, I can look on VC8 and see the log of the incoming connection or mail. When I'm configuring or debugging daemons, it's easy to check what they're logging. :)
Hopefully, other may find this a useful suggestion.
-Kurt
-- [Place] snail://USA/07030/NJ/Hoboken/PO Box 5136/Kurt M. Hockenbury [Stamp] [Here.]
Lee Olds
Date: Fri, 12 Jan 1996 10:40:58 CST
From: Lee Olds <leeo@slmd.com>
Subject: Minor nit in oct LG article on TRAP
Hi. Linux Gazette looks real good!
I have a small correction for the act article on TRAP. You said:
>So, what are the signals that can be trapped? The most common ones, >I'm told are the following: > > 0 - program exit > 1 - hang-up > 2 - user interrupt (ctrl-c) > 9 - kill signal from another process
Those are probably the most commonly sent signals. All except for signal 9 could be the most commonly trapped signals as well. But signal 9 is special and can never be caught, so the shell has no way to trap it.
-- Lee Olds olds@eskimo.com
Brian Matheson
Date: Thu, 21 Dec 1995 22:14:44 CST
From: Brian Matheson <bmath@sirius.com>
Subject: Stuff
Just wanted to drop you a line and say hey again and let you know that I've become another of your avid fans! Since you mentioned that you'd be doing a little work on the ole' toy box, I thought I'd point out something in SunSite's Toys directory that's just too groovey to be overlooked: Xfishtank.
It turns your root window into a fish tank and runs beautifully in the background while I'm doing other stuff on my poor-boy's 486/33 with 8 megs of RAM, and it doesn't even complain about netscape eating up the color palette.
Another thing that I'd forgotten about but came across while trying to set up a ppp connection with our system at work is a little technique for trimming down those pesky syslogs. I don't know about you, but I usually forget about them until something doesn't work and then realize that they've grown to outrageous proportions in my absent-mindedness. So I came up with a one-liner to grep out the lines for a certain date:
grep "`date | cut -b5-10`" /var/adm/syslog | cut -b8-
Just make an alias for it and you're all set. Works great on /var/adm/messages too!
Many thanks for sharing the great work you do with the rest of us, the countless hours you spend aren't going unappreciated!
Happy Hollidays!
Brian
bmath@sirius.com
Liang Ng
Date: Fri, 12 Jan 1996 22:00:14 CST
From: Liang Ng <L.S.Ng@ecs.soton.ac.uk>
Subject: Re: Update of xterm title bar. Solution.
John M. Fisk writes:
> Excellent! I've saved your message and will _definitely_ include it with > the next edition of the LG! Glad to see that you were able to get this > worked out :-) Also, thanks SO much for taking the time to write and > offer this suggestion.
Thanks John. I am very pleased to hear that.
BTW, here is a suggestion about xlock.
I am not using xdm. I use startx to start the X Window. When I used xlock on the X Window, I found that it was actually possible to switch to the Virtual Console (VC) from which I started X Window. i.e. xlock is broken! I, in fact anyone, was able to suspend startx by pressing ctrl-z at the VC, then kill xlock.
Solution to this: log myself out from the virtual console, before I leave my desk.
This solution obviously works. But it is a nuisance to see the closing down message at the VC when X Window is shut down later. So I created a Bash function startx() which redirect the stderr to /dev/null:
startx() { /usr/X11/bin/startx $* 2> /dev/null }
Note that the full path of the actual startx must be used or else Bash will interpret it as recursive function. Note also that alias in Bash does not carry arguments, hence I have to use function instead.
Of course, if you really want, you could do:
startx() { /usr/X11/bin/startx $* 2> /dev/null & clear logout }
Which logs you out from the VC as soon as X Window is started.
Cheers
Liang S Ng
Tim Wallace
Date: Sat, 23 Dec 1995 08:43:30 CST
From: Tim Wallace <root@web.tenn.com>
Subject: RE: Stuff
John,
Here's the crontab that comes with RH2.0 and RH2.1.
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # Run any at jobs every minute * * * * * root /usr/sbin/atrun # Make the whatis databases 21 03 * * 1 root /usr/sbin/makewhatis /usr/man /usr/X11R6/man # Make the find.codes database 47 02 * * * root /usr/bin/updatedb --prunepaths='/tmp /proc /mnt /var/tmp /dev' 2> /dev/null # Trim wtmp 45 02 * * * root find /var/log/wtmp -size +32k -exec cp /dev/null {} \; # Remove /var/tmp files not accessed in 10 days 43 02 * * * root find /var/tmp/* -atime +3 -exec rm -f {} \; 2> /dev/null # Remove /tmp files not accessed in 10 days # I commented out this line because I tend to "store" stuff in /tmp # 41 02 * * * root find /tmp/* -atime +10 -exec rm -f {} \; 2> /dev/null # Remove formatted man pages not accessed in 10 days 39 02 * * * root find /var/catman/cat?/* -atime +10 -exec rm -f {} \; 2> /dev/null # Remove and TeX fonts not used in 10 days 35 02 * * * root find /var/lib/texmf/* -type f -atime +10 -exec rm -f {} \; 2> /dev/null # Trim log files 34 02 * * * root find /var/log/maillog -size +16k -exec /bin/mail -s "{}" root < /var/log/maillog \; -exec cp /dev/null {} \; 33 02 * * * root find /var/log/messages -size +32k -exec /bin/mail -s "{}" root < /var/log/messages \; -exec cp /dev/null {} \; 32 02 * * * root find /var/log/secure -size +16k -exec /bin/mail -s "{}" root < /var/log/secure \; -exec cp /dev/null {} \; 31 02 * * * root find /var/log/spooler -size +16k -exec /bin/mail -s "{}" root < /var/log/spooler \; -exec cp /dev/null {} \; 30 02 * * * root find /var/log/cron -size +16k -exec /bin/mail -s "{}" root < /var/log/cron \; -exec cp /dev/null {} \;
The wordwrapping should be un-done of course.
Tim
Tim Newsome
Date: Wed, 27 Dec 1995 17:53:03 CST
From: Tim Newsome <drz@cybercomm.net>
Subject: Linux Gazette
Hi,
You're probably getting millions of these, but I just wanted to say the Linux Gazette absolutely positively completely rules. Just discovered it and reading from all of them. You taught me a bunch of stuff about fvwm there. :-) Dunno if the following is in one of the issues I haven't read yet, but here goes. To have a background picture for X put the following at the end of your .xinitrc:
xv +root -rmode 5 background.gif -quit &
I can't remember what the -rmode 5 means. Probably centered in the screen. Neat thing, anyway.
Keep it up!
Tim
Tim Newsome. drz@cybercomm.net. https://www.cybercomm.net/~drz/. HotJava rules. Pretending to work is almost as hard as the real thing. Linux > Windows. question=(be||!be); answer=42; hack!=crack; IRC=fun; cogite ergo rideo. 1+1=3 for large values of 1. CMU here I come! NO CARRIER
Matt Welland
Date: Tue, 12 Dec 1995 15:49:22 CST
From: Matt Welland >welland@node71.tmp.medtronic.COM>
Subject: System configuration - beyound RCS
John,
I've been using RCS for some time to control my system files but I found I needed something more. I wanted to be able to check out an entire machine configuration so I installed cvs. I checked in all the pertinent files in /etc, /usr/lib/uucp, /usr/lib/news and so forth and gave them a module name. Now I can check out any of several machine configurations each with its own hostname and setup. CVS took a little learning but if you know and understand RCS it is pretty easy. Follow the instructions that come with CVS and keep a system backup until you are confident everything is rock solid and predictable.
-Matt
-- ,------------------------------------------------------------. | Matt Welland | Medtronic/Micro-Rel | | Design Engineer | IC CAE group | `--------------welland@tmp.medtronic.com---------------------'
Ed Petron
Date: Sat, 30 Dec 1995 11:39:04 -0500
From: Ed Petron <epetron@leba.net>
Subject: Linux
John, I've been looking at your Linux home page and it's really great! I've got a home page devoted to technical and network computing at https://www.leba.net/~epetron. It's always great to "meet" another Linux afficianado. Drop me line if you get a chance. I'll be looking forward to hearing from you.
Ed Petron
Morpheus
Date: Fri, 15 Dec 1995 23:40:26 CST
From: Morpheus <morpheus@markwoon.student.Princeton.EDU>
Subject: RE: Comments and xterm titlebars
On Fri, 15 Dec 1995, John M. Fisk wrote:
> Hmmm... sounds interesting. Are these shell scripts or binaries? I've > seen the pushd and popd programs mentioned before but have never run > across them. Do you recall where you picked these up?
Whoops. I just checked, and pushd and popd are shell built-ins. See how much cooler tcsh is? ;^) (Just joking, don't want to start a my-shell-is- better-than-your-shell flamewar here.)
Another neat tcsh built-in is "where" which searches your path for a file name you provide (eg. "where popd" in which case it returns "popd" is a shell built-in)
And on killing proceses, check out killall, it should come with the standard distribution. It'll kill all proceses with the name you provide (the slay alias I sent you probably only works on the first, I've never tested this). Very handy with runaway processes that spawn child processes faster than rabbits in heat.
> I'm not sure... I've not enough of a guru to know how you'd enter a > control or escape character from the keyboard. I simply used a text > editor to do this and then messed around with it after creating a > small shell program.
BTW, the emacs sequence for inserting control sequences is Control-q, followed by the desired control sequence. Adding this to the Nov. issue of LG will probably help out emacs users, fitting in well with your description on how to do so with vi... ;)
> Have a Merry Christmas and Happy New Year.
You too!
~Morpheus~~~~morpheus@vanaheim.princeton.edu~~~~~~~~E Pluribus Linux~~~~~
By Jesper Pedersen <blackie@imada.ou.dk>
In this article I'll try to describe what Tcl/Tk is, its strong points, and its draw backs. Furthermore, I'll give some examples of using tcl/tk and provide references to materials about Tcl/Tk. Finally, I'll try to help you avoid a few of the common pitfalls with using Tcl/Tk.
Despite this initial intention, Tcl has come to be used heavily as a programming language in itself, and it has turned out to be a very good language for quick and dirty programming. It's much more difficult to use it as a language for larger programs. (This requires much more dicipline and structure)
set var 10
, this will set var to the value
10set var
, this will read the content of var, ie.
return the value 10.$var
, this will expand to the value of
varTo try this, use the command puts, which will write it's argument to standard out (stdout), try this:
set var 10 puts [set var] puts $varThis will write 10 twice to standard out. Well what were those brackets for? In Tcl, commands inside brackets are expanded, so the evaluation strategy for the command
puts [set var]
, is as follows:
set var
which evaluates to
10
puts 10
, which write 10 to standard
out.
set var 10 puts "var is $var" puts {the name of the variable is $var}Executing the second line prints var is 10, while the third line prints the name of the variable is $var. Here is how it works: if the outermost delimiter is a brace, then everything inside is seen literally, whereas if the outermost delimiter is a quotion mark, then every thing inside is expanded.
puts {every thing "is [$litterals]"} puts "here \[things\] shall be \"escaped\" !\$"This will print
every thing "is [$litterals]"
and
here [things] shall be "escaped" !$
Different commands require different numbers of parameters, while
braces and quotes are used to group things which are meant as
one parameter! I.e if you want to set
var to "hello world", write set var "hello
world"
or set var {hello world}
. In this
example there is no difference between using braces or quotes.
However, if you want to set var to the content of var1 plus a
string you would write set var "var1 is $var1"
. If
you had written set var {var1 is $var1}
var1 wouldn't have been expanded, since it is protected
by the braces.
label .label -text "Hello World" button .button -text "Quit" -command exit pack .label .buttonTry it!
Well what happens? Three Tk functions are called: label, button and pack. The first one creates a label with the text "Hello World". The next one create a button, gives it the title "Quit", and associates it with the Tcl command "exit". The third line maps them in a window, so you can see them on the screen.
Ok let's try to understand what this is all about. To do that, please invoke the manual page for the label command. In this you can see that the label command has several options available. The idea is that you can configure the label in several ways. All the options have a default value You can, for example, configure the color of the text, the font, the text itself (as we did in the example), and so forth. Some of the options are specific for the label command, while others are general for several different Tk functions. The specific ones are listed and described in the manual page for the label command, while the more general ones are listed and described in the manual page called options.
The last thing to understand about the label command is its first argument, which is .label in our example above. This argument is the name of the label. The name is used, when you want to place the label on the screen, or later on when you want to configure some of its properties (eg. change the text of the label).
To fully understand this, we have to learn about the packing strategy of Tk.
To see what you can do with this command, see the manual page for pack. Here are a few examples which will give you an idea of what can be done. Exchange the pack line above with each of these lines, and rerun the example:
pack .label .button -side left
pack .label .button -pady 20
pack .label -pady 100 -padx 100 -anchor c
pack .button -anchor e
### creating two frames for the different part of the text frame .top frame .middle frame .bottom pack .top .middle .bottom ### creating the entry with a label label .top.label -text "Please type your name:" entry .top.entry -textvariable name pack .top.label .top.entry -side left -padx 5 ### creating the check button checkbutton .middle.but -text "I'm good at tcl!" \ -variable good pack .middle.but ### creating the OK and CANCEL button button .bottom.ok -text OK -command okCmd button .bottom.cancel -text Cancel -command exit pack .bottom.ok .bottom.cancel -side left ### creating the command to call when the OK ### button is pressed proc okCmd {} { global name good puts "Hi $name" if {$good} { puts "You are good at tcl...great" } else { puts "You should really learn Tcl, before you play with TK" } }
In Tk, variables for entries, check buttons, radio buttons and other widgets which require user interaction, are saved in global variables. So when I create an entry with - textvariable name then the contents of this entry is reflected in the global variable name.
In the example above, I create a procedure which is called when the OK button is pressed. The procedure definition is, in fact, very simple and very much like in C. See the manual page for proc for a full description on how it works.
In this procedure I declare the variables name and good for global variables with the global command. (Again, if you want to know more see the manual page!) In the example above you can see an example of a widget which is packed inside another. There is nothing fancy about it. The frame widget is just a container which help you pack the things in a smart way on your screen. When I have created the frame .top I can pack things inside it, and I have to name its sub widget with the .top name prefixed.
The rest of the example should be clear, but if there is something you don't understand, please see the manual page, all the information is located in them!
First of all, don't start creating large applications in Tcl right away. There are several reasons for this, but the the most important one is that Tcl is a very bad language for incremental programming, when you want structure too... The best advice I can give you is to try tcl/tk out, see other applications and read about Tcl and Tk's possibility. When you've done all these things you'll understand what it can do, and then you start to design your applications before you program. The worst thing you can do in Tcl is to program a basic version of your interface, and then start to patch it until it is what you really want! I know that...I've tried it myself :-(
When you have a better understanding of Tcl, you'll find that it lacks composed types: the only types you have in Tcl are strings, list of strings, and associative arrays (also known as maps in other languages). The associative arrays can not contain arrays them self! This is a significant problem if you use Tcl as a programming language for larger programs. One solution for this problem is to create virtual modules. The idea is that you name your variables with a module prefix. If you,for example, have some part of your program which takes care of help, you may see this as a module, and variables used by this part of the program are all name something like help`variable. This strategy makes it a bit harder to expand variables since the pling character is a word separator in variables. This means that if you write $a`b, Tcl will try to expand a variable called $a. So, to expand this variable you would write ${a`b} or [set a`b].
You can view these using the command:
man ./filename.n
or, you can convert these to plain ASCII text files which can be viewed or printed using a BASH shell script such as:
#!/bin/sh # for SUFFIX in 1 3 n do find -name "*.$SUFFIX" -print | while read FILE do echo -n "converting $FILE to ${FILE%%.$SUFFIX}.txt ..." groff -Tascii -mandoc $FILE 2>/dev/null | col -b > ${FILE%%.$SUFFIX}.txt echo "done." done done echo echo "Finished converting files." echo
If you wish to convert these to PostScript format for printing, you can use a similar BASH script:
#!/bin/sh # for SUFFIX in 1 3 n do find -name "*.$SUFFIX" -print | while read FILE do echo -n "converting $FILE to ${FILE%%.$SUFFIX}.ps ..." groff -Tps -mandoc $FILE > ${FILE%%.$SUFFIX}.ps 2>/dev/null echo "done." done done echo echo "Finished converting files." echo
Well first of all, the USENET group for Tcl/Tk is comp.lang.tcl. The traffic is heavy, but don't fear: it's worth it..!
[I want to publically thank Jesper for his very gracious offer to write this article which was no small feat. Please do not hesitate to drop him a note and send your comments, suggestions, and most of all a very hearty thanks. Also, if you're interested in joining the Dotfile Generator development team, let Jesper know -- he'll be glad to let you know how you can join this effort! Drop him a note at:
Jesper Pedersen <blackie@imada.ou.dk>
Thanks! --John]
While doing a bit of Christmas Break reading over December I ran across a quote that is attributed to Larry Wall, author of the PERL scripting language. He's purported to have said something to the effect:
"There's always another way to do things..."
Whether apocryphal or not, there's a good deal of truth to this little saw and the contributions to an improved HACK script are ample evidence of this. For those of you tuning in late... a couple months ago I made a suggestion that, when modifying all those tricky little configuration files you've got lying around your system, you should use a shell script that would ensure that there's a backup copy of the config file made before you get your grubby little mitts all over it (and whose mom wouldn't agree with this... :-).
The shell script that I offered was the merest skeleton of a suggestion and pretty minimalistic. The November edition of the LG had a couple very significant improvedments to this. Here's a self-avowed "Yet another HACK script" that offers another robust improvement. It's authored by Dean Carpenter who graciously gave permission for this to be printed.
Please drop him a note of thanks! You should also read his opening comments in this file -- RTFM :-)
enjoy!
From: Dean Carpenter <deano@areyes.com>
Subject: Re: Yet another HACK script
Here's hack with the owner/group changes in it.
Now it will maintain correct user and groups perms.
#!/bin/bash # # hack file|dir # # Edit a file, keeping an original copy in $DIST and a linked # copy in $CONFIG. Uses RCS to log all changes. # # If hacking a dir, simply make a symlink to the dir in $TREE # in the proper full-path dir. # # Creates the following files : # # A copy of the original file in /configs/original # A symlink to the original file in /configs/links # An RCS control file in /configs/RCS # A full-path symlink to the original file in /configs/tree # # The full-path is to keep the directory structure available for # backing up with tar -h to dump actual files, not just # the symlinks. # # That is, backing up with the command # # (cd /configs/tree ; tar -cvhf configs.tar . ) # # will create a tar file with all hack'd files in their correct # original locations with relative paths. # # Dean Carpenter # deano@areyes.com # Location of directories # CONFIG Storage dir for links # DIST Original files go here # RCS RCS control files go here # TREE Full path copies of files # CONFIG='/configs/links' DIST='/configs/original' RCS='/configs/RCS' TREE='/configs/tree' # Default to not being a directory DIR='no' EDITOR='vi' CURR_DIR=`pwd` # # Make sure only root can hack # if [ "$LOGNAME" != "root" ] then echo "hack: user not logged in as root" exit 1 fi # # Need a filename to hack # if [ "$1" = "" ] then echo "hack: filename missing" exit 2 fi # # If it's a directory we need to link to $TREE # if [ -d $1 ] then echo "hack: " $1 " is a directory" DIR='yes' fi # # Must be an existing file or a directory # if [ ! -f $1 ] && [ ! -d $1 ] then echo "hack: bad filename" exit 3 fi # # Must be a real file, not a symlink # if [ -L $1 ] then echo "hack: Must be a real file, not a symlink" exit 4 fi # # Make sure the repository exists # if [ ! -d $CONFIG ] then echo "hack: Creating " $CONFIG mkdir --parents $CONFIG chmod 711 $CONFIG fi # # And the dir to hold the original files # if [ ! -d $DIST ] then echo "hack: Creating " $DIST mkdir --parents $DIST chmod 711 $DIST fi # # And a place for the RCS files # if [ ! -d $RCS ] then echo "hack: Creating " $RCS mkdir --parents $RCS chmod 711 $RCS fi # # And finally a place for the full pathname files # if [ ! -d $TREE ] then echo "hack: Creating " $TREE mkdir --parents $TREE chmod 711 $TREE fi # # Get the name and dir of the file # BASENAME=`basename $1` DIRNAME=`dirname $1` # # If the DIRNAME is just here, then we want the full path # if [ "$DIRNAME" = "." ] then DIRNAME=$CURR_DIR fi # # If it's only a partial dir in the path to the file, we need # to get the full path to the file. # if [ "$DIRNAME" != "$CURR_DIR" ] then if [ -f "$CURR_DIR"/"$DIRNAME"/"$BASENAME" ] then DIRNAME=$CURR_DIR/$DIRNAME fi fi # # If we're off the root, we don't want a doubled up // # if [ "$DIRNAME" = "/" ] then FILE=$DIRNAME$BASENAME else FILE=$DIRNAME/$BASENAME fi # # Get the original owner and group of the file to hack # OWNER=`ls -l $1 | awk ' { print $3 } ' ` GROUP=`ls -l $1 | awk ' { print $4 } ' ` # # If it's a dir, make a link in $TREE then exit # if [ "$DIR" = "yes" ] then if [ ! -L $TREE$FILE ] then mkdir --parents $TREE/$DIRNAME ln -s "$FILE" "$TREE$FILE" echo "hack: Linking " $FILE "to" $TREE$FILE chown $OWNER.$GROUP $TREE$FILE else echo "hack: " $TREE$FILE " already exists" fi exit 0 fi # # Copy the original to save it before hacking it. # Make sure it's owned/grouped as the original is. # if [ ! -f $DIST/$BASENAME.dist ] then cp $1 $DIST/$BASENAME.dist echo "hack: creating file " $DIST/$BASENAME".dist" chown $OWNER.$GROUP $DIST/$BASENAME.dist elif [ -f $DIST/$BASENAME.dist ] then echo "hack: " $DIST/$BASENAME".dist already exists" else echo "hack: fatal error in " $DIST/$BASENAME".dist" exit 5 fi # # Create the symlink and update owner/group. # if [ -f $FILE ] then if [ ! -L $CONFIG/$BASENAME ] then ln -s "$FILE" "$CONFIG/$BASENAME" echo "hack: linking " $FILE "to " $CONFIG/$BASENAME chown $OWNER.$GROUP $CONFIG/$BASENAME fi if [ ! -L $TREE$FILE ] then mkdir --parents $TREE/$DIRNAME ln -s "$FILE" "$TREE$FILE" echo "hack: linking " $FILE " to " $TREE$FILE chown $OWNER.$GROUP $TREE$FILE fi else echo "hack: Whoa, something happened to " $1 exit 6 fi # # If it's never been RCS'd before, check the file in and # create a logging line for it. # if [ ! -f $RCS/$BASENAME",v" ] then ci -u $1 $RCS/$BASENAME,v fi # # Check the file out and lock it # co -l $1 $RCS/$BASENAME,v # # Make the changes # $EDITOR $CONFIG/$BASENAME # # Check the file back in and re-own/group it # ci -u $1 $RCS/$BASENAME,v chown $OWNER.$GROUP $FILE ############################################################# -- Dean Carpenter deano@areyes.com Areyes, Inc. dcarpenter@kraft.com
You can drop Dean at note at deano@areyes.com
By Edward Cameron
[A number of folks have written and asked about reviews of the various Linux distributions -- Slackware, RedHat, Debian, Yggdrasil, Linux-FT, and so forth. Since I honestly don't have the diskspace, time, or technical expertise to do this justice I wanted to thank Edward Cameron for graciously offering to review one of these fine products: the Caldera Network Desktop by the Caldera Corporation.
[Ed very kindly sent a complete set of HTML documents which can be found in their entirety at the links above. The CND Review comes complete with some very nice screen dumps of the various parts of the desktop which will give you a bit of a feel for the product. The Web Surfing page provides some interesting links to Netscape plug-ins, and E-Mail and Linux gives some useful suggestions for setting up popclient and PINE for email service under Linux.
[If you have comments, suggestions, ideas, or just want to chat about this program, please don't hesitate to drop Ed a note! He can be reached at:
Edward Cameron <ecame119@ecity.net>
[If anyone else has experiences they'd like to share with setting up or using any of the various Linux distributions please drop me a note and let me know. The only proviso is that serious OS-bashing will be considered a no-no. (all verbal scuffles will be directed to the comp.os.linux.advocacy group... :-)
[Enjoy! --John]
By Nic Tjirkalli <nic@pipex-sa.net>
Well, there is no reason why dozing or apparently warping OSs should have the monopoly on this - the same can be done with the FVWM in X. As of verision 1.24 (release r) of the FVWM, an FvwmAudio module has been included, as a standard module. Quoting the FvwmAudio (1.0) man, the FvwmAudio module :-
[To find out which version of fvwm you're using you can enter the following either in an xterm or at the console -- note that what is printed to the screen is actually an error message that happens to contain the Fvwm version number.
fvwm --version
What you'll see might be something like:
Fvwm Ver 1.23b usage: fvwm [-d dpy] [-debug] [-f config_file] [-s] fvwm: another WM is running--John]
Compile - have no fear, Fvwm compiles VERY EASILY and
the included documentation is complete and useful.
To compile Fvwm,
tar -zxvf fvwm-2.0.39.tgz
cd fvwm
xmkmf
make Makefiles make all
make install make install.man
NOTE:-
However, I have opted to use an external audio player (SOX) for a whole host of reasons. Pull down LSOX (the linux version of SOX) from Sunsite or your favourite mirror. The file you need is :- Lsox-linux.tar.gz in the /pub/Linux/apps/sound/convert/ directory. Compile - yes compile as follows :
tar -zxvf Lsox-linux.tar.gz
cd Lsox
cp Makefile Sox/ cp pat.c Sox/
cd Sox make
cp sox /usr/bin/ ln -s /usr/bin/sox /usr/bin/play ln -s /usr/bin/sox /usr/bin/pplay
There are two requirements for activating the FVWM audio features :-
The configuration info for allowing the Fvwm to produce sounds can either be placed in
Add the following statement to the fvwm configuration file, uder the
Function "InitFunction" section :
Module "I" FvwmAudio
*FvwmAudioPlayCmd /usr/bin/play
*FvwmAudioPlayCmd /usr/bin/play
will cause FVWM to use the play program
*FvwmAudioPlayCmd builtin-rplay
will cause FVWM to use the built in rplay support
*FvwmAudioDir /usr/lib/sounds
*FvwmAudioDelay 5
*FvwmAudio window-manager-event sound
Possible window-manager-events include :-
So, for example, if you want to use the /usr/bin/play utility to play audio
files which are loacted in the /usr/local/sounds directory and
have a 6 second sound delay and play the file bang.au when a window
is iconified and play up.wav when a window is raised, you would
add the following statements to your .fvwmrc file :-
*FvwmAudioPlayCmd /usr/bin/play *FvwmAudioDir /usr/local/sounds *FvwmAudioDelay 6 *FvwmAudio iconify bang.au *FvwmAudio raise_window up.wav
[Pretty cool, eh? Betcha always wanted to to hear that gravelly-Dirty-Harry warning "Go ahead... Make my day..." when you reached for the 'ol kill button to zap some ill-mannered program...?
[Well, here's your chance! :-) Don't forget to drop Nic and note and let him know how things worked out. --John]
By Jesper Pedersen <blackie@imada.ou.dk>
This short overview will describe some of the things you can do with strace. First of all, what is strace? Strace is a program which traces system calls, so that you can see what other programs do internally. This article will not describe how strace works, or any of its many options, but rather give some examples of what it can be used for.
open("etc/ld.so.cache" O_RDONLY) = 4 open("home/blackie/.Xauthority" O_RDONLY) = 5 open("usr/X11R6/lib/X11/locale/locale.alias" O_RDONLY) = 5 open("usr/X11R6/lib/X11/locale/locale.alias" O_RDONLY) = 5 open("usr/X11R6/lib/X11/locale/locale.dir" O_RDONLY) = 5 open("usr/X11R6/lib/X11/locale/C/XLC_LOCALE" O_RDONLY) = 5 open("home/blackie/.Xdefaults-blixen" O_RDONLY) = -1 ENOENT (No such open("usr/X11R6/lib/X11/app-defaults/XTerm" O_RDONLY) = 5
Well what does this mean?
First, you can see that it is the system call open which has been called. Second, you can see which file has been opened (or was tried to open). Next, you can see which mode the file has been open in (see open(2)) And finally, you can see which file handler (if any) was returned from the system call.
Of course it's not xterm which reads all these files, but X11, which allows xterm to map the window. BUT, if you wanted to know where to put your app-default files, you would have found it.
access(".hi", F_OK) = -1 ENOENT (No such file or directory) access(".hi", F_OK) = -1 ENOENT (No such file or directory) access(".hi", F_OK) = -1 ENOENT (No such file or directory)which means that it tries to access the file .hi repeatily. Knowing this, you may want to check this file.
Kind regards Jesper.
[Again, I want to thank Jesper, and all those who have taken the time to sit down and write up their suggestions and ideas! There's no way that I could write with the breadth of experience that many of you offer. Please don't forget to drop Jesper, or any of these authors, a note and let them know that you appreciate their efforts!
[Thanks! --John]
By James McDuffie <mcduffie@scsn.net>
Here I will give an explanation on how I set up a PLIP (Parallel Line IP) connection between a Linux desktop and a DOS/Windows laptop. This can be useful especially if you have a useable laptop that does not have a PCMCIA slot for an ethernet card. Or it can be useful if you're on a tight budget. This is in no way a complete guide to PLIP, (or maybe it is) it is simply an explanation into how I did things.
First of all, you will of course need the right kind of cable. The cable simply needs to be a parallel cable that is compatible with programs such as DOS's InterServer and Interlink or a program such as Lap Link. All I did was go into a local computer specialty store and told them what I wanted. Places such as Wal-Mart and Best Buy will not have the correct cable but a locally owned shop will most likely have one.
After you have the cable you must recompile your kernel to support PLIP. The newer kernels have it built-in so you won't need a patch. For the DOS/Windows computer you will need the packet driver for PLIP. After a bit of searching I did find it here:
ftp://ftp.crynwr.com/drivers/plip.zip
The program runs under DOS and acts like a Ethernet Packet driver. Also, on the Windows computer you will need Trumpet Winsock. This serves as the TCP/IP interface. Otherwise, you can probably find TCP/IP software for DOS. I had WinSock on hand and so that's what I used.
Okay, now we have all the software. Lets start by setting up the Linux computer. First off, you must set up the DOS computer's address in the /etc/hosts. If you do not have a registered IP for it you can use one of the 192.168.*.* private address space IPS. Just make up numbers to you pleasure where the *'s are. I have set it up so that my Linux computer is called `conspiracy` and my Windows computer is called `duncan`. Next, all I did was add the following lines to my /etc/rc.d/rc.inet1:
/sbin/ifconfig plip1 conspiracy pointopoint duncan arp up /sbin/route add duncanThis sets up the interface and then adds a route to it. Simple, eh? Make note that plip1=lpt1, plip2=lpt2 and so on.
Once you have done this you can set up the Windows computer. To do this simply add these lines to the autoexec.bat:
c:\plip\plip.com 0x60 c:\tcpip\winsock\winpkt.com 0x60
This sets the plip.com program on packet vector 0x60 and then loads the winpkt.com program that comes with trumpet winsock on the same vector. If the cable is something other than lpt1 you will have to tell plip.com the irq number and io address. Also, winpkt.com needs to run to make the packet vector avaliable to Windows. From here we go to the actual setup under Trumpet Winsock. All you have to do is unselect SLIP or PPP and enter 60 into the box labeled Packet vector. Then tell it the IP address you gave it, the IP address of the Linux computer as the default gateway and the Name Server as either you computer's ip or your ISP's address for its nameservers if your going to connect it to the Internet (more on this later). Close the setup and re-run Winsock and you should have it! Put winsock in your startup group and you have everything setup automatically!
If you want to access the Internet through the Linux computer on the Windows computer you will need to set up IP Masquerading, for info on this see the NET-2-HOWTO. This simply masquerades the Windows computer with your Linux computer's IP address.
Also I have found a program that lets you run X-Windows programs under Windows! It is located at:
Set it up according to directions and then all you have to do is telnet in from the Windows computer then set the display to the Windows computer (`DISPLAY=duncan:0.0` for instance) and run the program desired. There is nothing cooler than running xv under Windows! Hope all this helped.
James McDuffie
mcduffie@scsn.net
[Kudos to James for an excellent article! I've had a number of y'all (that's "second person plural" here in Nashville :-) write and ask various questions about networking. This is something that I admit to knowing VERY little about.
[I really appreciate Jame's clear and concise write-up. Drop him a note of thanks once you've started cruisin' Linux-Space from your 'Doze laptop via that Linux box of your's...
[Have fun! --John]
By Brian Freeze <freezeb@www.deltastar.nb.ca>
Cron lives up to what the computer was designed for. Give it a task, walk away, and know it will get done without any more manual direction from you. Schedule backups, remove old logs, create stats from logs, or, if you run a dialup connection, run a script that will ping a server to ensure the connection is up and, if down, redial your provider in whatever time frame the script is told. The nice thing about cron is you tell it when to run and how often to run. I have a script launched by cron to check my connection every 5 mins and if down redial and another to check mail every 2 hours from a popserver all of which is done behind the scenes and system resources are only called upon at the given time the script must run.
A good source for beginners on this subject is a book by Matt Welsh and Lar Kaufman called Running Linux. Pages 191 to 196 give details on using cron.
www# crontab -ethis will bring up crontab into the "vi editor" which is set as the default editor. You can change this by sending the following command at the prompt.
www# setenv VISUAL=emacs This is for the Bourne-compatable shell. www# setenv VISUAL emacs This is for the C shell.Check out the man page for cron as well as the man page on your shell and how to set the default editor. Once in the editor, we can see that there are already system scripts or programs running from cron. Most have 2 things in common: they have a comment line started with a "#", and the next line is the command line.
Crontab command line:
"minute" "hour" "dayofmonth" "month" "day of week" "script and shell commands go here"
example:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/checkmailAs you can see, I have set cron to run every 5 mins which would not be very efficient unless I got a lot of mail and was at my machine all the time. It would be better to set it as follows using the hour field:
0 6,7,8,9,10,11,12,13,14,15,16,17,18,23 * * * /usr/local/bin/checkmailAs you can see, the fields are seperated by a space and you can put multiple entries in the field, as I have done, seperated by a comma. You can put shell commands in the command field such as this example taken from the book Running Linux:
0 1 1 * * find /tmp -atime 3 -exec rm -f {} \;This one will run the command at 1AM every month on the 1st day to check and remove old files from /tmp.
######################################################################## This is a script that I have included that will check a dialup line by pinging a name server to see if the lines up and if down call up dip to redial the line. I set cron to run this every 5 mins. My provider has a limit of 15 mins if the line is inactive and will drop it. ######################################################################### check-link #!/bin/sh PING=/tmp/ping.$$ #check that link is up ping -q -c 1 131.202.3.3 > $PING 2>1 awk ' /transmitted/ { if ($1 == $4) { exit 0 } else { exit 254 } } ' $PING rslt=$? rm $PING if [ $rslt -eq 254 ] then #restart link /sbin/dip /etc/dipscript & fi #########################################################################Now that you know how to edit and enter things in cron, experiment with it as this is what linux is all about and, no, I haven't figured out how to get cron to let the dogs out at 3am but I'm working on it.
regards
Brian C. Freeze
freezeb@nbnet.nb.ca
freezeb@www.deltastar.nb.ca
[Well, here's another subject about which I admit to knowing very little. I honestly haven't tinkered much with cron and so VERY much appreciate Brian's helpful write up. I'm sure that there are a LOT of things that can be done with cron. If you have any ideas or suggestions please drop a note to Brian or myself!
[Enjoy! --John]
By Bill Powers <wepprop@nettap.com>
First let me say I love your features. I've gotten a lot of useful information on things to get and things to try from reading them. I especially liked the 'trap /usr/bin/clear EXIT' to clear the screen on logout. Very elegant.
I thought I'd toss a couple of small things back your way. First, I spent a lot of time looking for a fully threaded newsreader that worked halfway well across a serial link. Something that would basically work as well as tin does on a network. I had just about despaired of ever finding something when I came across 'knews'. It's on sunsite in system/Printing, it's fairly easy to set up, and with a couple of resources set in .Xdefaults, it's reasonably fast. If you ever have time to try it out, try setting these resources to start with:
Knews.*.retrieveDescriptions: false Knews.*.readActiveFile: false Knews.*.fillNewsrcFile: true Knews.*.threadEmAll: true
One of the neat things about Linux is there's always more than one way to skin the proverbial cat. I wanted to check for mail every few minutes while connected to my service provider, but I came up with a completely different solution than you did. I added the following line to my ip-up script:
crontab ~/.crontab
Then I created a one line .crontab file in my home directory:
*/5 * * * * /root/mailman > /dev/console 2>&1
/root/mailman is another one line script invoking popclient to retrieve the mail and append it to the calling users mail folder. I put it in /root because it contains my password and userid. /root has _very_ restrictive permissions. The redirected output is necessary, otherwise crontab will sent email to root whenever something happens it doesn't like. If you're using xbiff or xmailbox (which I'm using now, since I read about it in your mag), you can redirect any output to /dev/null instead of /dev/console.
One vital piece of the crontab mail checking scheme: In order to turn it off when you shut down ppp you need the following line in the ip-down script:
crontab -d $USER
I'm sure putting together the Gazette must be hard work. I just want to let you know someone out there appreciates it.
-- Bill Powers wepprop@nettap.com Linux: Resistance is futile...
[Well, I'll have to admit that I'm terminally a creature of habit. I started using skim/xskim a couple months ago and use them almost daily to pick up the news which I can read later. I haven't tried knews and so very much appreciate Bill's offering this suggestion, as well as those for using crontab! -- John]
By Paul Lussier < pll@swl.msd.ray.com>
Hi John,
Listen, I must agree with you regarding the "My Favorite Editor" Holy War. Telling some one they should use a different editor is a great way to start a huge flame war. I, of course, must put my $.02 in though!
I personnally think emacs is the way to go. Not to say that one shouldn't know the basics of vi. If you're system goes down, vi will always be there! But there are just some things emacs can do that vi is either not suited for or just can't do. Here are some of my favorite emacs features:
And my single, most favorite feature of them all!!!!! This one let's you save "TONS" of space:
Some one may say, "Why is this good, why would I need this?" Well, I for one use this feature all the time. For example, every single file in my home directory (at work, soon to be at home) is gzipped. I mean everything! If I need to edit it, I open it in emacs, I need to print it (this works for post scripts too:) I zcat filename.gz | lpr, if I need to grep it, zgrep whatever filename.gz, if I need to quikly look at it, zless it! To give you an idea of the amount of space I've saved, at work my home directory structure is about 116MB. If everything were untarred and un-gzipped, the total size would be over 1/2GB (yes, that's Gigabyte!). That means my total directory size is 1/5 what it would be uncompressed.
Well, that's it for now. As I said, these are just a few of my favorite features of emacs. And if anyone is interested in what the .emacs file needs to contain, I'll be more than happy to help them out. If anyone wants to play with emacs, I highly recommend trying the built in, on-line tutorial. Type emacs at the command line, and when emacs starts up, type Ctrl-h,t (hit the Control & h keys together, let go, then hit 't'), and follow the directions.
See ya,
Paul
P.S. Another helpful hint on saving space: Netscape and Mosaic are both capable of reading, decompressing, and displaying .gz and .Z files. So, all those .html files could be stored as .html.gz :)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - Paul Lussier = It is a good day =The next best thing to doing - = Raytheon ESD SEL - to put slinkies -something smart is not doing = - pll@swl.msd.ray.com = on escalators = something stupid. - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = Quote of the week: = - Real programmers don't document. If it was hard to write, - = it should be hard to understand. = -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[Well, as I've mentioned before, I'm a bit of a VI affectionado myself and use it all the time (actually, I use VIM :-). I've tried to get a handle on emacs and am slowly learning the ropes. I definitely welcome any ideas or suggestions for using emacs and appreciate Paul's offering these ideas! --John]
By Werner Fleck <wf@fleXoft.hamburg.netsurf.de>
Hi!
After reading your less tricks in " Savings with a Floppy Library" " and " Less is just a Whole Lot More!" in the November Linux Gazette, I can give you some more tricks for less-290.
When you are looking for information in several files, there is an easier way than grepp'ing and then less'ing: use less to grep the files. Just start less with the list of files e.g. "less *" and type "/" "*" "a-regular-expression". less will then grep the expression in all the given files, just type "n" to go the next result.
There also is a better way to view compressed files than "zcat *.gz | less" or "zless *.gz" -- just use less and its buildin pipe feature.
The first thing you have to do is creating the following shell script as "/usr/local/bin/lesspipe"
----- /usr/local/bin/lesspipe ----- #!/bin/sh case $1 in *.gz|*.tgz) CMD='gzip -d -c -q';; *.Z) CMD='uncompress -c';; *.zip) CMD='unzip -c -qq';; *.zoo) CMD='zoo xqp';; *.arc) CMD='arc xpn';; *) unset CMD;; esac if [ -n "$CMD" ]; then $CMD $1 2> /dev/null fi ------------------------------------and make it executable: "chmod +x /usr/local/bin/lesspipe". Then set an environment variable: "setenv LESSOPEN "lesspipe %s "" for the c-shell or "LESSOPEN "lesspipe %s" export LESSOPEN" for the bourne-shell. Now, when you try to view a file.gz less will pipe it through gzip and you can almost do whatever you do with non compressed files e.g. use :p or :n to change files or "/" " *" to grep them.
Werner
P.S. The Linux Gazette is great!
-- Werner Fleck * Phone: +49 40 2 54 59 170 * Werner.Fleck@hamburg.netsurf.de Fax: +49 40 2 54 59 199 * Fleck@prompt.de Home: +49 4104 8 08 86 *
[Once again, I'm very much indebted to all of the folks who've written and offered clarifications and suggestions. Kudos to Werner for this clear and concise explanation! This is an excellent method for handling text files which compress well -- similar to the suggestions offered by Paul in the section on Emacs (above). --John]
By Mats Andtbacka
<mandtbac@abo.fi>
and Matt Welland
<welland@node71.tmp.medtronic.COM>
and Jon Klippenstein
<jon@dparrot.bohica.net>
[One of the cool things about Linux is -- as has been pointed out over and over again -- that there are often a myriad of ways to get the same task done. As the following three messages point out, this is very much the case with the kscreen function presented in last month's LG which clears up a buggered screen. Thanks to all who wrote back! -- John]
Date: Sat, 09 Dec 1995 18:09:23 CST
Sender: <mandtbac@ra.abo.fi>
From: Mats Andtbacka <mandtbac@abo.fi>
Subject: Linux Gazette: kscreen
I was just reading the Nov. edition, and ran into your defining kscreen() in BASH. Nice little reimplementation of reset(1). ;-)
Not a tip, but a curious coincidence: On every system I've used - Linux, SunOs, Solaris - cat'ing the ls(1) binary to the screen does the very same. On Linux consoles, dumb VT220 clones, MS-Kermit doing its VT320 dumb terminal impersonation; haven't tried the Windoze terminal yet, mostly because I haven't screwed it up like that yet. ;-)
I've no clue _why_ it works, presumably those ls binaries contain terminal control escape sequences somewhere near the end of the file; but the curious fact remains that it always does seem to work. Mention this to newbies, and watch them go "so what"; mention it to Unix "journeymen", and watch their jaws drop. Gurus tend to know it, but then they would...
-- " ... got to contaminate to alleviate this loneliness i now know the depths i reach are limitless... " -- nin
Date: Tue, 12 Dec 1995 14:48:51 CST
Sender: <welland@node71.tmp.medtronic.COM>
From: Matt Welland <welland@node71.tmp.medtronic.COM>
Subject: Fixing hosed screen font on a VT
I've had pretty good luck simply entering the command "setfont" Seems to fix the screen every time.
-Matt P.S. Thanks for the Gazette! -- ,------------------------------------------------------------. | Matt Welland | Medtronic/Micro-Rel | | Senior Design Engineer | IC CAE group | `--------------welland@tmp.medtronic.com---------------------'
Date: Sun, 17 Dec 1995 01:14:26 CST
From: Jon Klippenstein <jon@dparrot.bohica.net>
Hiya!
I just started reading the LG, but I think it's great!! I downloaded all the issues tonight, so I can view them in netscape on me linux box. (I've gotta junk freenet account, running lynx, as my only net.access, except for my dparrot.bohica.net UUCP link).
Anyway, a couple of things I'd like to point out about the ... uhh (zips back to X) ... November issue:
1) Under 'Using kscreen to clear the screen': I didn't know about the 'echo ne "\017"' trick, but if you are ever stuck, and forget kscreen (yah right :)), I originally used echo ^V (control-V) hit Escape, c and then hit enter. Same thing I'm sure, but I thought I'd point it out :)
2) Under 'Space Savings with a Floppy Library': You say that you like using ext2 for floppys, and I'd have to agree that the filenames feature is nice, but I was reading on the Linux 8086 website, that they are going to use the minix filesystem. To get to the point, from what I've read, MINIX's filesystem is very small, compact and fast on floppys. I'd have to assyme that's why Slackware uses it for their boot floppys.
Anyway, just me 2 cents..
jon
p.s. I'm only in Jr. High School, am still starting with linux, but IT's GREEEEAAAAAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTTT!!!!!!!!!!!! :) -- Jon Klippenstein -- jon@dparrot.bohica.net Linux: The Choice of a GNU Generation
[Ok... this was the hands-down winner in the "Followup of the Month" department! :-) For all you "Weekend Linux Mechanics" out there... here's some more too-way-Cool stuff to play with... drop the authors a note and say thanks! --John]
By Haykel Ben Jemia
<haykfaje@linux.zrz.TU-Berlin.DE>
and Adam Sjoegren
<asjo@diku.dk>
and Liang Ng
<L.S.Ng@ecs.soton.ac.uk>
and Jacob Waltz
<waltz@pcjiw.lampf.lanl.gov>
and Jean Liddle
<jean@interaccess.com>
and David Billington
<bli@betty.compulink.co.uk>
and Alan Wild
<arwild01@scic.intel.com>
Date: Tue, 19 Dec 1995 17:48:15 CST
From: Haykel Ben Jemia <haykfaje@linux.zrz.TU-Berlin.DE>
Subject: Changing that xterm titlebar interactively!
Hi John,
first of all I want to thank you and all the others for doing this GREAT work and publishing such a NICE, USEFULL and FUNNY gazette like the Linux Gazette.
In the November issue there is an interesting article entitled: "Changing that xterm titlebar interactively!" It was for me especially interesting because at the same day when I read this article, a friend asked me if I knew how to make an 'xterm' put the current working directory in his titlebar. And here is the extract from that article that spoke about this feature : "...One of the interesting things that is described is using escape sequences to force an xterm to display the current working directory. This is described nicely on page 259. Thing is, you need to be using the C Shell in order to make this work because it uses the "cwd" variable to keep track of where you are. In the process of tinkering around with this I wasn't able to get BASH to cooperate, BUT, I did learn a couple tricks that are kinda fun...."
That's why I tried to make this possible. And after reading some man pages, I really succeeded to find a solution on how to make BASH force an xterm to print the content of the $PWD variable in its titlebar, and here is how : these lines must be added to $HOME/.bashrc :
-------------------------------CUT HERE-------------------------------------- # set the title of an xterm to $PWD xtitle() { if [ "$TERM" = "xterm" ]; then echo -e "^[]2;$PWD^G" fi } #Change th 'cd' command to use xtitle() cd() { builtin cd $1 xtitle } ------------------------------------CUT HERE---------------------------------
P.S. Don't forget to enter the ESC-characters like discribed in the article !!
So I hope this will enjoy some BASH users ;)
Ciao
-- _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/ Haykel Ben Jemia _/_/_/_/_/_/_/_/_/_/_/_/ _/ Mail : Haykfaje@linux.zrz.tu-berlin.de _/_/_/_/_/_/_/_/_/ _/ Voice : ++49-030-306 60 34 _/_/_/_/_/_/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Date: Mon, 25 Dec 1995 20:54:41 CST
From: Adam Sjoegren <asjo@diku.dk>br>
Subject: LG Nov 95, xterm titlebar
Hi John.
I really like your Linux Gazette. All those little things that are so easy and obvious, that takes an enourmous amount of time to figure out, if you don't start your search the right place. Collected in LG. Great :-)
One thing about your piece about changing the titlebar interactively: For those of us who don't know, or don't care, how to enter ESCAPE and CTRL-G chars in our favourite text-editors; do like this:
echo -n -e "\033]2;Too way cool (right, John?) :-)\007"
The man-page for "echo" gave me the hint for the "e" option and voila: I don't have to learn how to enter weird chars in my text-editor, and even better - when your write in LG, you don't have to explain the chars (in the examples the chars show up blank (on my paper - I like to read the Linux Gazette on paper sitting in the couch :-))).
Thanks for a great effort - I will write something for LG when I find something of interest.
Merry christmas,
-- Picasso didn't start with painting women Adam Sj{\o}gren with three eyes and square breasts. He asjo@diku.dk knew how to paint a cow. <URL:https://www.diku.dk/students/asjo/>
Date: Tue, 09 Jan 1996 16:15:46 CST
From: Liang Ng <L.S.Ng@ecs.soton.ac.uk>
Subject: Update of xterm title bar. Solution.
Hi,
After I posted my previous email, I started to tinker with xtitle a bit more. And I found a solution to my problem. It is easy: just redirect the output to the tty of xterm whose title bar you want to change. e.g.
$ xtitle "News" > /dev/ttyp1
will change the xterm title bar in ttyp1.
This command can be executed from any local xterm shell. Just a note on 'ps'. 'ps' will show the tty and the command line for a xterm. However, if the program in the xterm is not active, it will show only the command instead of the command line. So for example when I do rlogin to other hosts, it is a nuisance when I cannot see from the ps output the host which rlogin is connected to. I will need to press a key or two in the rlogin xterm to activate it, so that ps will now show the full command line with the hostname of rlogin included.
This is what I do typically:
$ ps < to find out which tty is doing what PID TTY STAT TIME COMMAND 877 pp2 SW 0:01 (trn) 976 pp3 S 0:00 (rlogin) 977 pp3 S 0:00 (rlogin) 1183 pp4 S 0:00 rlogin monet 1185 pp4 S 0:00 rlogin monet
Then I set 'trn' title to 'News' by
$ xtitle "News" > /dev/ttyp2
And ttyp4 title to 'Monet' by
$ xtitle "Monet" > /dev/ttyp4
But I do not know which host is the rlogin talking to on ttyp3, because it has been inactive for a long time. So I need to touch it and ps again, so that the hostname is shown:
$ ps 976 pp3 S 0:00 rlogin renoir 977 pp3 S 0:00 rlogin renoir
So I will now do:
$ xtitle "Renoir" > /dev/ttyp3
One last thing, anyone know how to solve this 'ps' command line problem?
L S Ng
From: Liang Ng <L.S.Ng@ecs.soton.ac.uk>
Subject: xterm title bar. Again.
Arrggghhh.. This is addicting. I have been wasting my time.
Anyway, here are some suggestion about the default xtitle, which I think would be more useful than 'xterminal:/dev/ttyp1 plus Date'.
NAME=`hostname | perl -ne 'print "\u$_"'` xtitle() { if [ "$*" != "" ]; then echo -n "ESC]2;$*^G" else echo -n "ESC]2;$NAME `/usr/bin/tty`^G" fi }
(Note: please replace ESC with the actual ESC character.)
So the default will show the hostname with the first character capitalized and the tty.
L S Ng
Date: Sun, 03 Dec 1995 20:08:49 CST
From: Jacob Waltz <waltz@pcjiw.lampf.lanl.gov>
Subject: XTerm title tricks
Greetings!
Here's another little trick I use with regards to xterm titles.. My linux box is smack dab in the middle of an SGI cluster at work, and needless to say I do a lot of telnetting. So to remind me which machine I'm on, I put the following into my .cshrc file on every machine I use:
#!/bin/csh set MYHOST=`echo $HOST | sed 's/\./ /g' | awk '{print $1}'` alias cd 'cd \!*;echo -n "^[]2;$MYHOST-$cwd^G"'
and then the following into my .login:
echo -n "^[]2;$MYHOST-$cwd^G" echo -n "^[]1;$MYHOST^G"
Now, let me explain what this does...in the .cshrc file, the first line sets the host. Since some machines here spit out the entire name, while some just spit out the machine name (i.e. pcjiw.lampf.lanl.gov versus just pcjiw) the sed and the awk trim off everything but just the machine name. Now, the two lines in the .login file echo the machine name to both the xterm title bar and the icon name. Secondly, you will notice the alias for cd ... this just puts the current working directory into the titlebar - this little trick is basically straight out of O'Reilly's _X_Window_System_User's_Guide_ .
On thing I have yet to figure out is how to get the xterm title and icon name to change back when I log out...my temporary fix is the following alias in my .login file:
alias renew 'source ~/.cshrc; source ~/.login'
When I log off a machine, I just type in 'renew' first thing. Perhaps not the most elegant way to do it, but it works! Although I think one might be able to do something with the .logout file and the REMOTEHOST environment variable...but the current directory might be a little trickier...
Anyhow, hope this is useful to someone!
-- jacob waltz "Republicans understand the los alamos national laboratory importance of bondage between waltz@pcjiw.lampf.lanl.gov a mother and her child." #include-former V.P Dan Quayle
Date: Thu, 14 Dec 1995 10:27:03 CST
From: Jean Liddle <jean@interaccess.com>
Subject: xterm title prompts with bash
Hi,
Thanks for the nice tip in the Linux Gazette -- dynamic xterm titles seem to be a trick which I relearn and forget again from time to time -- it's nice to have a handy reference on-line!
To get a dynamic path working under bash I did the following:
function goto { cd $1; /usr/local/bin/xterm_title `pwd`; } alias cd=goto
where /usr/local/bin/xterm contains just one line taken from your example script:
echo "^[]2;$*^G"
(my editor won't let me enter the escape character - I did this by cutting and pasting to a cat redirected to the abovementioned filename)
there may be more elegant ways to do this, but this works for getting the current directory on the titlebar.
enjoy,
Jean.
-- email: jean@sgwoi.com | Opinions expressed could only have come from jean@interaccess.com | my own sick mind, not my employer's. ------------------------------------------------------------------------------ When you go out strolling through the world you do not have the "right not to be offended" by the values and cultures of other peoples/countries/religions. -- internet user, on Republican-proposed internet censorship
Date: Sat, 30 Dec 1995 19:36:36 +0000 (GMT)
From: David Billington <bli@betty.compulink.co.uk>
Subject: Xterm title bar & working directory
Dear John, thanks for Linux Gazette, it's by far the best resource I've found on the Web.
Getting the bash shell to update an xterm title bar with your current directory :-
if [ $TERM = xterm ] then PS1='\033]2;`pwd`\007$ ' fi
\033 & \007 are the octal vales for ESC and ^G respectively. `pwd` gets replaced with the working directory each time the prompt is displayed. It's important to use single quotes to enclose the string not double.
Putting the directory path in the title bar is much better than having it clutering up your prompt line.
Thanks again for a superb publication !
Dave Billington.
From: Alan Wild <arwild01@scic.intel.com>
Subject: Interactive X-title Bars
I don't know is someone has beaten me to this or not, but here is how you can place your current path in your title bar using either bash or tcsh. These will probably port to other shells to, I have only checked them with the two aforementioned.
Note:
Anyway. . .
bash:
export PS1="^[]xterm: \w^G\h\$ "
tcsh
set prompt = "%{^[];%}xterm: %~%{^G%}%m%% "
-Alan Wild
Note: please direct all replies to arwild01@starbase.spd.louisville.edu the account that I am at currently will only be in use for a few short months. -- Alan Wild arwild01@starbase.spd.louisville.edu f/s/c arwild01@scic.intel.com
Yup, it's true. Finally got sendmail to "work correctly". What I mean is this... I've got a standalone Linux box that has intermittent connection to the 'Net via a PPP connection through the University. Previously, when trying to send mail to a remote address, sendmail would complain that it was undeliverable and bounce it back as a reject...
Arghh...
Several months ago, I discovered XF-Mail, a graphical XForms-based mail client, which can be configured to queue outgoing mail. I've been happily using it ever since. However, I recently got sendmail to queue up remote mail while still delivering local mail right away! Very cool...
But the hero of this story actually is...
Leif Erlingsson <Leif.Erlingsson@mailbox.swipnet.se>
Truth is, Leif wrote a very handy little guide to getting this done. It's part of the Linux HOWTO series and is one of the mini-HOWTO's. I happened to come across this one on the InfoMagic Linux Developer's November, 1995 CDROM on disk 1 in the /HOWTO/mini/ directory. If you haven't been purusing these valuable documents from time to time...
you ought to. :-)
First, let me extend a very heartfelt thanks to Leif for making this available. And, to make this easy for all of you to find, I've included a plain text copy of the Queue-R-Mail mini-HOWTO which you should definitely read in its entirety before plunging into this.
So... let's see what Lief did to make this bit of magic happen...
Stuff you'll need:
Here's a list of the programs and packages that I used to get this working. FYI, I'm currently using the Slackware 3.0.0 ELF distribution and so you'll find these packages at any Linux archive site that mirrors that Slackware distribution.
Now it goes without saying that you can probably find these packages and tools in other distributions and should be able to work with these. I'm using these as an example -- also, Pat Volkerding has made the job of setting this stuff up pretty simple and so we'll gladly make use of this! :-)
At this point, it might be helpful for you to repeat after me...
THIS WORKED FOR JOHN... IT MIGHT NOT WORK FOR ME...
THIS WORKED FOR JOHN... IT MIGHT NOT WORK FOR ME...
THIS WORKED FOR JOHN... IT MIGHT NOT WORK FOR ME...
You get the picture.
The standard disclaimer at this point is: I'm NOT a Linux/UNIX/sendmail guru and probably won't be for a couple decades. In light of this, you should realize that while this worked for me, it might not work for you. There's an old proverb about "the blind leading the blind..."
Caveat emptor
Anyway, now that I have that off my chest :-)
From this point on, it was pretty easy to get things going. I read through the "Queue-R-Mail" document a few times, AND skimmed over the /usr/src/sendmail/README's that came with the distribution. What I ended up doing was the following:
[1] logged in as root (yeah, I've finally broken the "gotta be root all the time" habit :-) and changed directory to the /usr/src/sendmail/cf/cf directory.
[2] in the /usr/src/sendmail/cf/cf directory, I located the file "linux.smtp.mc" which I copied to "fiskhaus.mc". I did this at the instruction of the README.linux file that comes with the Slackware distribution. There are two pre-configured *.mc files that come with the smailcfg.tgz package that have already been customized for Linux -- one to be used for SMTP-only sites with a nameserver, and one for SMTP-only sites without a nameserver. Since I have access to a nameserver through the University, I used the first one.
[3] having created my own "fiskhaus.mc" file, I made the following modifications:
this is the original linux.smtp.mc file:
include(`../m4/cf.m4') VERSIONID(`linux for smtp-only setup')dnl OSTYPE(linux) FEATURE(nouucp)dnl FEATURE(always_add_domain)dnl MAILER(local)dnl MAILER(smtp)dnl
and this is the modified fiskhaus.mc file:
include(`../m4/cf.m4') VERSIONID(`linux for smtp-only setup')dnl OSTYPE(linux) FEATURE(nouucp)dnl FEATURE(always_add_domain)dnl dnl # The following is the suggested method for getting Sendmail 8.6.x to dnl # queue up remote mail instead of sending it immediately -- from the dnl # `Queue-R-Mail' mini-HOWTO. dnl # dnl # Defer Delivery to "expensive" mailers until next time the queue is dnl # processed using "OcTrue" and make sure smtp mailers are "expensive". dnl # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive dnl # mailers".) / Leif.Erlingsson@mailbox.swipnet.se dnl # define(`confCON_EXPENSIVE', `True') define(SMTP_MAILER_FLAGS, e) MAILER(local)dnl MAILER(smtp)dnl
Now, those of you who've already read Lief's HOWTO will recognize this! Basically, all I did was add the comment lines (denoted by the "dnl" at the beginning of the line) and the two "define" lines.
I'm NOT going to hazard a guess as to why this works. I've read the HOWTO and understand the essence of the logic. However, just exactly why these additions work is something that I honestly can't say that I fully grasp...
Then again, I'm not sure exactly how my car works either, but it still gets me to school each day... :-)
[4] once those modifications were added, I simply created the new *.cf file by invoking:
m4 fiskhaus.mc > ../../FiskHaus.cfin the /usr/src/sendmail/cf/cf directory. This puts the newly created file in the /usr/src/sendmail directory.
[5] the last step was to copy the "FiskHaus.cf" file to /etc/sendmail.cf AFTER I'd made a backup copy of the current sendmail.cf file. (Remember... "rm is forever...")
cp /etc/sendmail.cf /etc/sendmail.cf.bak cp FiskHaus.cf /etc/sendmail.cf
At this point, we're ready to play! If you do this, you'll need to force sendmail to re-read the /etc/sendmail.cf file. Doing a ps -ax listing will give you the PID of the sendmail daemon:
FiskHaus /usr/src/sendmail # ps -ax PID TTY STAT TIME COMMAND 1 ? SW 0:01 (init) 6 ? S 0:00 (update) 7 ? S 0:00 update (bdflush) 30 ? S 0:00 /usr/sbin/syslogd 32 ? SW 0:00 (klogd) 34 ? SW 0:00 (inetd) 36 ? SW 0:00 (lpd) 45 ? SW 0:00 (sendmail) [...snip!]Knowing that the PID for sendmail is 45, we can get it to reinitialize itself using something like:
kill -HUP 45
Sending sendmail the "HUP" signal causes it to initialize itself once again, re-reading its configuration file. Having done this, sendmail was now queuing up all remote mail!
Major coup d'etat!
Now in reality, I'm still using XF-Mail for doing the majority of my mail reading and composing. However, it's great to now be able to use the text-based mail clients such as pine, elm, or even plain 'ol mail to send off a quick note from the console. I must admit, too, that pine is still pretty near and dear to my heart. It is a pretty huge program but it comes with so many features that it really is an excellent mail client and the one that I occasionally still fall back on when I don't want to fire up X.
One last point. To check the mail queue, you simply invoke the command:
mailqThis will print out a listing of all the mail in the outgoing queue. To send queued mail once a connection has been made, you invoke:
sendmail -qBeauty of it is, you don't have to be root in order to get these to work -- any user can check the mail queue or tell sendmail to attempt to deliver mail that is in the queue. Also, I used the suggestion in Lief's HOWTO to set up an rc.sendmail file that starts the sendmail daemon at boot time but does NOT attempt to deliver it. There is a bit of file shuffling involved with this, but it works quite well and so far nothing has gotten lost in the process.
I'll leave it up to you and Lief to decide if you want to do this... :-)
Anyway, that's my product testimonial. Have fun and enjoy!
--John
OK, let me 'fess up here that this is another minor bit of plagerism :-)
Using the keypad as a means of changing from one virtual terminal to another is an idea that I originally came across in the November, 1995 issue of the Linux Journal (which is Issue 19). The article entitled "The Best Without X" was written by Alessandro Rubini <rubini@ipvvis.unipv.it> -- the author of the gpm mouse server. Alessandro presents an excellent discussion of maximizing a Linux system in a non-X Window environment. He includes a discussion of the programs gpm, open, and SVGATextMode, and then recommends several text-based productivity tools such as emacs, jed, mc, minicom, and gnuplot.
Before going on, let me put in a blatant plug for the Linux Journal.
Buy it!
Read it!
Seriously. The guys at SSC who publish the Linux Journal are providing a VERY valuable service to the Linux community. In the last couple issues (Issues 19 - 21) there have been articles on:
There have also been regular feature articles by Stephen Uhl on tips for Tcl/Tk programming and by Aeleen Frisch (author of the must-have book "Essential System Administration", 2nd Edition, published by O'Reilly & Associates, Inc.) on issues of Linux system administration such as using LILO, adding a new disk to your system, and security.
If you haven't been getting this journal, write your mom, tell her you want your birthday present now, and give her the URL for the Linux Journal. If you mom happens not to be "connected to the 'Net" :-) you can still have her call in your subscription to:
phone (206) 782-7733
This will put her in contact with the nice folks at the LJ who'll be happy to take her $22 and start sending you this excellent journal. BTW, this is a U.S. phone number. In case you think your mother would rather use plain 'ol snail mail...
Linux Journal
PO Box 85867
Seattle, WA 98145-1867
$22 for U.S. subscribers
$27 for Canadian and Mexican subscribers
$32 for All Others
End blatant plug :-)
Now, where were we...?
Oh yeah... the VT thingie...
Among other suggestions that Alessandro makes in his article is that of using the keypad as a virtual terminal (VT) switcher. Since the keypad is rarely used unless you're using a calculator, this isn't too bad an idea. He didn't really explain fully how to do this and so, after a bit of tinkering and skimming over a few docs and manual pages, I was able to get this working and have been using it every since!
First thing to mention is that you'll need the kbd package which you should be able to find at one of the Sunsite mirrors in the pub/Linux/system/Keyboards directory. The current version appears to be kbd-0.90.tar.gz. If you're a Slackware user then you'll be offered this package at installation. Even if you don't have this installed and you're NOT using Slackware, I found that it compiled cleanly and installed without a hitch. This is the first thing you'll need to attend to.
Once you've gotten the kbd package installed, you'll need to create a keymap file to tinker with. Change to the /usr/lib/kbd/keytables directory and then make a copy of the default "defkeymap.map" file. I did something like:
cp defkeymap.map mykey.mapwhich created the "mykey.map" file I then used for customizations. Now at this point, you'll probably be tired of my saying this, but...
Be Careful!!
Remapping the keyboard can get you into serious trouble if you somehow manage to bugger it up. Loading a customized keymapping remaps the keys for everyone on the system, including root. If you make a complete mess of your keyboard you can hose yourself immensely!!
There, I feel better now.
Seriously, though, be sure to READ the manual pages BEFORE you go scrambling off to do this stuff. Make sure that you understand what you're doing. :-) The manual pages that you probably ought to have a look at are:
The first one, keytables, will give you a succinct overview of the keytables files used for keyboard mapping. This is considered required reading before you do anything. The next two are programs that you'll need to be familiar with -- showkey will let you find a key's keycode, loadkeys is the program that will actually let you load up a customized keytable mapping.
Once you've read these, we can continue...
Ok, now for the fun part :-)
What we'll need to do is edit the custom keymap file ("mykey.map") we just created. Fire up your favorite editor and edit the entries for the keypad keys. What you might first want to do is get a listing of the keycodes for these keys. When I use showkey, this is the output that I get:
FiskHaus [VT5] /usr/lib/kbd/keytables$ showkey kb mode was XLATE press any key (program terminates after 10s of last keypress)... keycode 82 press keycode 82 release keycode 79 press keycode 79 release keycode 80 press keycode 80 release keycode 81 press keycode 81 release keycode 75 press keycode 75 release keycode 76 press keycode 76 release keycode 77 press keycode 77 release keycode 71 press keycode 71 release keycode 72 press keycode 72 release keycode 73 press keycode 73 release FiskHaus [VT5] /usr/lib/kbd/keytables$This is a listing of the keycodes for the keypad keys 0, 1, 2, 3,..., 9. I simply invoked the showkey program and pressed keys 0 through 9. So, now I know that keypad key "0" represents keycode 82, key "1" represents 79, key "2" represent keycode 80, and so forth. Armed with this knowledge (and the results scratched down in my ever-present notebook... :-) we're ready to start tinkering.
The modifications you'll need to make might look something like this:
# # NUMERIC KEYPAD MAPPING # #keycode 71 = KP_7 keycode 71 = Console_7 shift keycode 71 = Console_17 alt keycode 71 = KP_7 #keycode 72 = KP_8 keycode 72 = Console_8 shift keycode 72 = Console_18 alt keycode 72 = KP_8 #keycode 73 = KP_9 keycode 73 = Console_9 shift keycode 73 = Console_19 alt keycode 73 = KP_9 keycode 74 = KP_Subtract #keycode 75 = KP_4 keycode 75 = Console_4 shift keycode 75 = Console_14 alt keycode 75 = KP_4 #keycode 76 = KP_5 keycode 76 = Console_5 shift keycode 76 = Console_15 alt keycode 76 = KP_5 #keycode 77 = KP_6 keycode 77 = Console_6 shift keycode 77 = Console_16 alt keycode 77 = KP_6 keycode 78 = KP_Add #keycode 79 = KP_1 keycode 79 = Console_1 shift keycode 79 = Console_11 alt keycode 79 = KP_1 #keycode 80 = KP_2 keycode 80 = Console_2 shift keycode 80 = Console_12 alt keycode 80 = KP_2 #keycode 81 = KP_3 keycode 81 = Console_3 shift keycode 81 = Console_13 alt keycode 81 = KP_3 #keycode 82 = KP_0 keycode 82 = Last_Console shift keycode 82 = Console_10 alt keycode 82 = KP_0 keycode 83 = KP_Period altgr control keycode 83 = Boot control alt keycode 83 = Boot
Those of you who've skimmed over the manual page for keytables will immediately recognize what's going on here :-) The manual page describes the form each entry takes as:
Each complete key definition line is of the form: keycode keynumber = keysym keysym keysym... keynumber is the internal identification number of the key, roughly equivalent to the scan code of it. keynumber can be given in decimal, octal or hexadecimal notation. Octal is denoted by a leading zero and hexadecimal by the prefix 0x. Each of the keysyms represent keyboard actions, of which up to 256 can be bound to a single key. The actions avail- able contain outputing Latin1 character codes or character sequences, switching consoles or keymaps, booting the machine etc. (The complete list can be obtained from dump- keys(1) by saying dumpkeys -l .)
So, using this "keycode keynumber = keysym keysym keysym" notation we can see that the first non-commented line:
keycode 71 = Console_7
maps the key with keycode "71" (which we discovered above is the keypad key "7") to "Console_7". So, what happens when we hit the keypad 7 key...?
You guessed it...!
ShaZZzzammm!! you're at VT number 7!
Too way cool :-)
Now, if you're wondering whether you can still, after this bit of remapping magic, use the 'ol ALT-F7 to get you to the same point, the answer is a qualified yes. It's qualified only in that is assumes that you haven't modified the function key entries. Let's look at this a moment...
Have you ever wondered just exactly where that 'ol ALT-Fn key combo came from and how it's able to transport you to another VT...? Just skim over the keymap file. Remember, the file that you used initially was the default keymap file and so it should indicate how the keys are mapped in the default case. So, grepping through the file takes you to another entry for the Console_7 keysym:
keycode 65 = F7 F19 Console_19 control keycode 65 = F31 shift control keycode 65 = F43 alt keycode 65 = Console_7 control alt keycode 65 = Console_7And there it is... on both the fourth and fifth stanzas for the entry for the F7 key. You can see here that if you hit either the ALT-F7 or the CTRL-ALT-F7 key combinations, that you'll find yourself at VT number 7. Which brings up another important point in this key mapping stuff...
Another bit of magic that we can apply to the keymap entries has to do with specifying what happens when you hit a key in combination with one or more modifiers. These are:
Which of the actions bound to a given key is taken when it is pressed depends on what modifiers are in effect at that moment. The keyboard driver supports 8 modifiers. These modifiers are labeled (completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR, CtrlL and CtrlR. Each of these modifiers has an associated weight of power of two according to the following table: modifier weight Shift 1 AltGr 2 Control 4 Alt 8 ShiftL 16 ShiftR 32 CtrlL 64 CtrlR 128(replicated from the keytables manual page)
So, now that "alt keycode 65 = Console_7" entry makes a bit more sense...
You see, if you add one or more modifiers to the "keycode keynumber = keysym" entry, you can map a modifier(s)+key combination to a different event. In the case mentioned above, this causes the ALT-F7 and the CTRL-ALT-F7 key combinations to switch to VT number 7.
So, let's see what we did with the keypad...
Taking a sample entry from the customized "mykey.map" file for the keypad "1" key (which is keycode 79) we find:
keycode 79 = Console_1 shift keycode 79 = Console_11 alt keycode 79 = KP_1This maps the keypad key 1 to Console_1, which has the action of switching to VT number 1. The next entry uses the shift key modifier. This allows us to use the shift-keypad 1 combination to switch to VT number 11, if this tty exists. The last entry is an important one that you'll want to think about adding. What it does is simply allow you to map the alt-keypad 1 combo to the default KP_1 action, which let's you use this as a numeric keypad when the NumLock is on.
So, if you've mapped your keys using the above, and you want to use the bc calculator and the keypad, you'd fire up bc, hit the NumLock key, and then use the ALT-Keypad combination to enter numbers. Careful, though! If you forget the ALT key, you might find yourself at another VT! :-)
Ok, now that you've gotten the basics, and you've modified your mymap.key file, all that's left to do is load this thing up. You can do this by invoking the loadkeys command, which you've alreay read about since you've skimmed over the manual page.
And, of course, you always read the manual page... :-)
To use your new keytable mapping, just enter the command:
loadkeys /usr/lib/kbd/keytables/mykey.mapYou should see a message indicating that the new keytable map is being loaded and voila! your new mapping is ready! Now, when you hit the keypad key 1 you should find yourself at VT 1, hit keypad 2 and you're at VT 2, hit keypad 0 and...
Ooops... we're back at VT 1
Which leads me to make a couple more points... :-)
There are a couple other VERY useful mappings that you can try, one of which is included with the above keypad remapping. These include:
Pretty cool...eh?
You'll see that, from the example above, we've mapped the keypad "0" key to Last_Console. This lets you quickly switch back and forth between two consoles simply by hitting the keypad "0" key.
The quick of wit will probably already have noticed that the keypad "0" key is quite a ways away from your fingers if you happen to be a touch-typer. The way to remedy this is actually suggested by Alessandro, and so let me finish by adding a few tips that he offers:
First, unless you find that you use the Caps Lock key often, it might be worthwhile to remap this to something more useful. Alessandro suggests turning it into a control key using the following modification:
keycode 58 = Control alt keycode 58 = Caps_Lockthis will remap the Caps Lock key (keycode 58 on my 101 keyboard) to control. Hitting the alt-Caps Lock combination restores the Caps_Lock function. Now, in case you'd rather use this as a means of switching quickly between two VT's using Last_Console which we just tried, you might use something like this:
keycode 58 = Last_Console alt keycode 58 = Caps_LockNow, it's a bit more awkward to use the alt-Caps Lock combo for Caps Locking, but it's a LOT faster to switch between VT's if you happen to be using a couple for editing/compiling or editing/reading-docs type of tasks. BTW, for all you VIM users out there... :-) In case you're willing to give up easy access to Caps Lock and want an ESC key that's a LOT handier...
keycode 58 = Escape alt keycode 58 = Caps_Lock
This converts your Caps Lock key to an extra ESC key. Now, when you're editing and need to alternate between edit and command modes, instead of fishing around for the Escape key, or trying to hit the control-[ combination, you have a handy ESC key twin right there next to the "a" key. Very cool :-)
Here are a couple more ideas...
We said above that the Decr_Console and Incr_Console functions will let us move either forward or backward though our VT's. Guess where they've been mapped...? You got it...! to the control-left_arrow and control-right_arrow key combinations:
keycode 105 = Left control keycode 105 = Decr_Console keycode 106 = Right control keycode 106 = Incr_ConsoleNow, when you hit the control-L or control-R arrow keys, you can cycle through your VT's. Those of you who happen to be using the default FVWM 1.2 configuration file may have discovered this little trick for desktop mobility.
Lastly, you can configure the Home and End keys to function as control-a and control-e keys, which is a standard Emacs keybinding that positions the cursor at the beginning or end of a line respectively. Again, you'll want to check the keycode numbers for the Home and End keys using showkey. Mine are 102 and 107 respectively. Now, to remap, you'd enter something like:
keycode 102 = Control_a keycode 107 = Control_eand you'd be all set! Home and End now take you to the beginning and end of a line. I can tell you that this works under the BASH shell. According to Alessandro, this should also work under both tsch and emacs.
Well, that should get you started! One last point to make: once you have a keymapping that you like (you can use loadkeys repeatedly to test new mappings) you should probably put an entry in the rc.local file that will load up the customized mapping. Something like:
if [ -r /usr/lib/kbd/keytables/mykey.map ]; then /usr/bin/loadkeys /usr/lib/kbd/keytables/mykey.map fithis will ensure that your mykey.map file exists and is readable before invoking the loadkeys program.
Have fun and let me know what sort of mischief you've gotten yourself into!
--John
Hey... you made it! This is the end, my friend :-)
I don't know about you, but I happen to really like this "Colophon" idea. Kind of gives me a chance to wrap up loose ends and just chat a bit... now that the majority of the writing has been done. I honestly don't write this until everything else is pretty much finished and then include all of those "... now, where am I going to put this" kind of stuff.
It also let's me ramble a bit, which I'm sure you've noticed that happens fairly frequently here :-)
Let me, once more, extend a sincere "thanks!" to everyone that took the time to write and offer their suggestions, thoughts, corrections, and ideas. I can't write this all on my own, both because of time and because I honestly don't know everything there is to know :-) Several of the authors in this month's LG sent me complete HTML documents that were pretty much "drop-in's". I am especially indebted to these folks.
Also, thanks to everyone who wrote asking about when the next LG would come out... I appreciate your interst AND your patience. As you can tell, these just keep getting bigger and bigger. This has been a HUGE amount of fun but I probably won't be able to get something out every month since I'm starting, what appears to be, a pretty busy semester. I'll try to get something out as often as I can, but I can't promise that it'll be every month.
Also, in my wanderings, I've come across a few sites that you might want to drop by... just some things that I found a bit interesting.
Finally, a couple of you wrote and asked where to find the program source for skim/xskim and addressbook-0.5 which I mentioned in the last edition of the LG. I apologize for not including the URL's and so here they are:
skim-0.82.tar.gz
at the GA Tech sunsite mirror
addressbook-0.5.tar.gz at the
ftp.aud.alcatel.com ftp site.
For those of you with a budding interest in Tcl/Tk programming, there is a HUGE collection of Tcl/Tk stuff at the alcatel site. If you're looking for a Tcl/Tk program and can't find it at your favorite Linux watering hole, this should be the next stop on your search. Also, you can find this site mirrored by the folks at ftp.neosoft.com.
Well, I guess that's about it. Hope you enjoyed!
See y'all later!
--John