💾 Archived View for gem.sdf.org › jmccue › consnews › issue09.txt captured on 2024-03-21 at 15:49:58.
-=-=-=-=-=-=-
___________________________________________________________________ issue 9 http://console-newsletter.hypermart.net __ __ _ _ __ __ )) __ console: tips,tricks & news about linux ((_ ((_)((\( _))((_)(( (('_ _______________________________________ [5/2000] "a good read.." + headlines Pizza-Pizza "Next time you buy a pizza at Little Caesars, the clerk at the cash register might well be using a Linux computer." "MaxSpeed makes hardware that lets companies plug numerous sets of keyboards, pointing devices and monitors into a single Linux server. The hardware, which is being used at FTD, Little Caesars and others, is geared for use at chain stores that have numerous outlets." http://news.cnet.com/news/0-1003-200-1584128.html?tag=st.ne.1002.thed.1003-200-1584128 -- + hmm.. "Wall Street analysts and information technology managers are watching to see if Linux reaches a fork in the road - with incompatible versions of the popular free operating system competing for adoption at small and large corporations. If branches emerge, the value of the open source operating system is likely to plummet." http://www.zdnet.com/intweek/stories/news/0,4164,2470425,00.html Pure hog-wash from the cronies at zdnet, they complain about a 'fork' among Linux vendor's for example - w/ lib5 and lib6 while totally ignoring the fact that, when compiled from source (packaging aside) all distros are essentially the same. Just click the WIN2K banner and they'll forgive you, sorta makes you go, "hmm.." -- + humorix Windows NT Beats Turned-Off Linux Box "Microsoft is touting the results of an independent study that compares the networking speeds of Windows NT and a computer loaded with Linux that was turned off." http://www.sjswebhack.com/microfits/prev/mstest.htm -- + new! whatis (note: "whatis" is a *nix command w/ a short one line description of a command.) uniq - remove duplicate lines from a sorted file -- + distro watch Red Hat Linux 6.2: http://www.redhat.com/ Finnix - self-contained, bootable Linux CD distribution: http://www.finnie.org/finnix/ -- + new apps rute 0.3.0 - aims to be the definitive guide for new users: http://www.obsidian.co.za/rute/ envelope 0.625 - full-featured envelope printer written in Perl: http://freefall.homeip.net/code/envelope/ Zdisk 1.53 - rescue system on one floppy disk: ftp://metalab.unc.edu/pub/Linux/system/recovery/ -- + article rsh (remote shell) - digs <mjs@nts-online.net> Have you ever needed to run a command on a remote unix machine, or maybe copy some files to/from a different host but didn't want to hassle with telnet or ftp? Most Linux distros ship with the rsh suite which comprise some very handy commands: rsh - remote shell rcp - remote copy rlogin - remote login Hold on hotrod... Before we get down to the facts, take note: the r[commands] are -not- at all secure. Which means someone sniffing your net-work can breech security. If this is a concern then checkout SSH (secure shell) at: http://www.employees.org/~satch/ssh/faq Ok back to our previously scheduled article :-) Use of the rsh commands requires four things: 1. the r[commands] must be on your machine 2. the remote box -must- be running the rshd daemon 3. an ~/.rhosts file on the remote boxen 4. (of course) some type of networking between the machines The host will probably run the daemon via inetd.conf here's a typical entry: shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L login stream tcp nowait root /usr/sbin/tcpd in.rlogind Your ~/.rhosts file (on the remote) contains several two column entries of -trusted hosts- and your -remote- login name. By way of telnet login into the remote host and with a editor create the .rhosts in your home directory like so: full_server_name login_name some_other_place login_name To clarify the syntax is, <local.server.com> <joe> where <local.server.com> is the -full- name of the local host. and <joe> is the proper login on the remote host your attempting to use. (hint, listing each machine in the others /etc/hosts file never hurts) note the commands: `hostname -l` (on the local box) will give you the full host name `whoami` (from the remote) will give you the proper login on the remote After you've edited the file, next you'll want to set the proper permissions or the rshd daemon will deny you access and verbally abuse you, from the remote: chmod 600 ~/.rhosts this makes the file owned and readable by you only. The output of, `ls -l ~/.rhosts` ought to look something like this: -rw------- 1 mjs users 39 Oct 22 22:11 .rhosts Now we should be ready for a test run. Enter the command: rlogin remote_host_name If you get prompted for a password then something is wrong, reread the above. Assuming the initial test worked logout out from the remote host and lets go to the next set of examples: rsh -l <remote_user> <remote_host> <remote_command> or rsh -l joe some_host.com date This should produce a response from some_host.com showing the output of the date command on your screen. note: If you omit the -l switch then rsh uses your local login name. So far so good, here are some more to try: copy from remote to local: rcp <remote_user>@<remote_host>:<remote_file> <local_file> or rcp joe@some_host.com:/home/joe/sample.txt sample.txt copy from local to remote: rcp <local_file> <remote_user>@<remote_host>:<remote_file> or rcp sample.txt joe@some_host.com:/home/joe/sample.txt Some nifty tricks: You can copy files from several hosts with one command: rcp joe@host1:/tmp/file1 wendy@host2:/tmp/file2 file.out Link the `rsh` command to a host name for ease of use: ln -sf /path/to/rsh remote_host_name then you can run commands like, some_host date some_host who some_host mail To return the exit code (to check for errors) on the remote, rsh some_host "command ; echo $?" -- + quote of the month "Duct tape is like the force. It has a light side, a dark side, and it holds the universe together." -Carl Zwanzig -- + grok If you want to change your shell, use the `chsh` command. Note: you will only be able to use root approved shells as specified in /etc/shells To use a text mode other than the default 80x25, such as 80x50 or even 132x60, put vga=ask into your lilo.conf file and then run lilo. When you reboot it will let you choose your video mode. When you decide which one you want, you can put vga=n where n is the number of the video mode you would like. -- + jargon :ad-hockery: /ad-hok'*r-ee/ n. [Purdue] 1. Gratuitous assumptions made inside certain programs, esp. expert systems, which lead to the appearance of semi-intelligent behavior but are in fact entirely arbitrary. For example, fuzzy-matching of input tokens that might be typing errors against a symbol table can make it look as though a program knows how to spell. 2. Special-case code to cope with some awkward input that would otherwise cause a program to {choke}, presuming normal inputs are dealt with in some cleaner and more regular way. -- + hobbes' internet timeline 1974 BBN opens Telenet, the first public packet data service (a commercial version of ARPANET) 1975 First ARPANET mailing list, MsgGroup, is created by Steve Walker. Einar Stefferud soon took over as moderator as the list was not automated at first. A science fiction list, SF-Lovers, was to become the most popular unofficial list in the early days. Satellite links cross two oceans (to Hawaii and UK) as the first TCP tests are run over them by Stanford, BBN, and UCL. -- + article Passing arguments to your script - digs <mjs@nts-online.net> 1. From batch files to scripting Initially coming from a DOS world I found that shell scripting(sh) in Linux was volumes stronger than batch files under command.com, (the default shell under DOS). But one aspect that always seemed to elude me was the passing of arguments under the bash shell. After much trial & error (& some help from friends) I finally came across the formula! Guru's out there will know this, and the rest of us will find this little tutorial quite enlighting. 2. This file, that file, grrr... to many files! For instance in slackware it takes _two separate scripts_ to manipulate my dial up connection: 'ppp-go' and 'ppp-off', sigh... there must be a better way of doing this I remember thinking. What I wanted was something like: 'net -on' and 'net -off' the idea being ONE command with options. 3. A better way As I discovered this is really simple. The secret is the use of the "case" statement and "place markers" The case statement simply filters a variable and a place marker is a positional indicator. When you enter a command at the shell it has a place marker: prompt# command command = $0 When you pass arguments to a command they also have place markers: prompt# command argument argument = $1 so, grep foo file = $0 $1 $2 4. Some examples #! /bin/sh case "$1" in a) echo "You entered: a" ;; b) echo "You entered: b" ;; c) echo "You entered: c" ;; *) echo "Usage: $0 {a|b|c}" exit 1 ;; esac exit 0 Let's suppose you use three editor's and for the sake of efficiency wanted to use only one command (and an argument) to use any of the three. #! /bin/sh # dont forget to `chmod +x this_file` to make it executable. # $0 is the name of your script, $1 is the editor, $2 is the # file to edit case "$1" in -j) #jed /path/joe "$2" ;; -v) #vim /path/vim "$2" ;; -e) #emacs /path/emacs "$2" ;; *) #user input not matched clear echo "Usage: $0 {-j|-v|-e} file" echo "You must specify an option, ONE of:" echo "j=joe, v=vim, e=emacs" exit 1 ;; esac exit 0 5. Using the script Invoking our script would work like this, to open "file" with "joe" as the editor: script -j file 6. Conclusions Study the above examples and you'll quickly think of several different uses. You can group several tools together in a master script and save yourself a whole lot of typing. Good luck. -- + funnies _______ (_)___oo) Ned the log ------------- . Particle man ---------------- _______ | \| _(_)oo___)_ |. }------ (_)oo(_)__oo) Ned family portrait | /| dragonfly chasing | particle man ------------------------------------------------------------------- -- + wrap up Coming next issue: Which distro should I use? - a reader tells all in this humorous article. Use a swap-file instead of a swap-partition. The antics of Ned and particle man and plenty of links to browse. console is not very far from 500 subscribers, & I'm simply amazed. As much a I'd like to take credit for that its you all that make this possible. My earnest thanks for the articles; email & of course all you loyal readers :) And as always, a warm welcome to new subscribers, if you have an idea or point of view you'd like to get across then here is your chance to make a splash. Just drop me a quick note along with your article and your ready to go! later on, digs -- + subscriptions & submittals To subscribe send a blank email to: console-subscribe@topica.com To unsubscribe send a blank email to: console-unsubscribe@topica.com To submit an article: http://console-newsletter.hypermart.net/ Past issues can be found at: http://console-newsletter.hypermart.net/old/ -- + about This issue of console was brought to you by: digs <mjs@nts-online.net> - chief writer & layout Hobbes' Internet Timeline (c)1993-9 by Robert H Zakon. http://www.isoc.org/zakon/Internet/History/HIT.html Console (c)99-00 Michael S Sanders, All Rights Reserved. -- eof