
All machines on the Internet are assigned a four-byte addresss(ex. 128.227.232.1) called its IP number that is guaranteed to be unique for each machine. This IP number is associated with a named address, which for most of us is easier to remember. For instance, the IP number 128.227.232.2 is associated with the named address creek.eel.ufl.edu. Anyone on the Internet can access this machine by knowing either its IP number or its named address. Both the named address and the IP number are refered to as the Internet address.
The named address creek.eel.ufl.edu can be broken into two sections. The first part - creek - is know as the hostname. The hostname command will give you the name of the machine you are currently working on.
%hostname creek %The second part of the address - eel.ufl.edu - is the domainname. The domainame is the same for every machine on the LAN. In the diagram above the machines calusa, creek, iriquois, calusa and navaho all have the same domainame. The nslookup (name service lookup) command can be used to get a machines named address and corresponding IP number.
% nslookup creek Name Server: sioux.eel.ufl.edu Address: 128.227.232.1 Name: creek.eel.ufl.edu Address: 128.227.232.2 %If you are on a machine you can access other machines on the same LAN by its hostname, since the domainnames are the same. However, outside of the LAN you need to use the full address.
% rlogin navaho
Please wait...checking for disk quotas
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the U.S. Government is subject to
restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause in DFARS 252.227-7013.
Hewlett-Packard Company
3000 Hanover Street
Rights for non-DOD U.S. Government Departments and Agencies are as set
forth in FAR 52.227-19(c)(1,2).
You have mail.
%
When you rlogin to a machine it assumes that your login name is the same. If your login name is different, you can use rlogin with the -l (login name) option to specify a different login name.
When you are finshed working on your current machine use the exit command to return to the previous machine.
%hostname navaho %exit logout Connection closed. % hostname creek %
% remsh navaho ls /tmpThis command will list all the files in the /tmp on the machine navaho. If you omit the command to remsh, it will act like the rlogin command.
Lets copy the /etc/hosts file on creek to our local machine and directory.
% rcp creek:/etc/hosts . % ls hosts hosts %The . signifies the local machine and directory. Just like cp the rcp command accepts the -p (permission) option, which will try to retain the file permissions, and the -r (recursive) option, which will recursively copy all the files and directories.
Lets connect to creek and ftp the /etc/motd file using an ascii transfer. First lets make a connection to creek.
% ftp creek Connected to creek.eel.ufl.edu. 220 creek FTP server (Version 1.7.109.2 Tue Jul 28 23:32:34 GMT 1992) ready. Name (creek:scot): scot 331 Password required for scot. Password: 230 User scot logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 1 drw-r--r-- 1 scot admin 1024 Apr 7 12:18 tutorial ftp>We are now connected to creek using the default binary file transfer. Since we want to transfer an ascii file we need to specify that to ftp.
ftp> ascii 200 Type set to A. ftp> cd /etc 250 CWD command successful. ftp> get motd 200 PORT command successful. 150 Opening ASCII mode data connection for motd (0 bytes). 226 Transfer complete. ftp> quit 221 Goodbye. %Some of the more useful ftp commands are listed in Table 7.5. The local_files are files that reside on the machine you are currently working, and the remote_files are files on the machine you are ftped to.
Table7.5: Useful ftp commands
----------------------------------------------------------------------------------------
Commands Description
----------------------------------------------------------------------------------------
open remote_machine Establish a connection to remote_machine
user user_name Log into the remote_machine on the current
connection which must already be open
bin Set file transfer to binary (ie programs)
ascii Set file transfer to ascii (ie text files)
ls List file and directories
pwd List current directory
get remote_file [local_files] Copy remote_file to the local system.
If the no local_file is specified ftp assigns
the remote_file name to the local_file name.
mget remote_files Copy remote_files from the remote system to
the local system. Can use wildcard characters
(ex. mget *.txt)
put local_file [remote_file] Copy local_file to the remote system. If the
remote_file is not specified ftp assigns local_file
name to the remote_file name.
mput local_files Copy local_files from the local system to the
remote system.
prompt Turn off ftp prompting. Useful when using mget
and mput to stop ftp from asking you whether to
perform the action
close Terminate the connection to the remote_machine
quit Exit the ftp command.
----------------------------------------------------------------------------------------------
%rusers creek.eel.ufl.edu thorn crow.eel.ufl.edu ychen navaho.eel.ufl.edu hsiao <CTRL-c>A machine will not appear in the output if no one is currently logged in to it. To view all the machines use the -a (all) option. To get a longer listing of a particular machine use the -l (long) option.
% rusers -l creek thorn creek.eel:console Mar 22 16:05 6:11 %The -l option gives me the login name, machine name, terminal port they are using, the time they logged in, and the CPU usage of the host.
Lets use our login name to determine what information the system has about us.
% finger scot Login name: scot In real life: Scott Miller Directory: /home/huron2/admin/scot Shell: /bin/tcsh On since Mar 31 12:18:18 on ttyp9 from iriquois:0.0 1 minute 23 seconds Idle Time No Plan. %You can determine someones login name, real name , home directory location, shell, last time they loged into the machine, and their plan and project. The plan, if there is one, is the contents of the users $HOME/.plan file. Another file, the $HOME/.project file is also displayed if it exists. These files can be used to give other users your schedules, quotes, quips, etc. If you finger yourself and you cannot read your plan or project file check the file permissions. To get information about users on remote machines you can use:
finger @address
finger login_name@address.
Where address is an Internet addresses.
The e-mail address of someone on your LAN is their login name. To mail to someone outside of your LAN you use:
login_name@address
Where address is an Internet addresses.
There are many good electronic mail packages that can be use with Unix. However, only a few come standard with Unix, the others your system adminstrator must install. Speak with you system administrator about which mailer they recommend.
One mailer that comes standard on many System V machines is mailx. The mailx (mail experimental) command has many features over the traditional mail program.
% mailx scot Subject: A test of mail This is a test of the mail package . EOT %We are first prompted for the Subject of the message. Type in the Subject and hit <RETURN>. Then type your message and end your message with a <CTRL-D> or a period on a line by itself.
You can send mail to several people by adding their name to the command line. If you had already had a file that you wanted to send you can redirect the standard input.
% mailx scot john sue < article %When you are typing the message you can give a command by using the tilde character (~). The ~? inside the message that you are composing will give you a list of these commands.
% mailx scot Subject: Another test of mail ~? -------------------- ~ ESCAPES ---------------------------- ~~ Quote a single tilde ~a,~A Autograph (insert 'sign' variable) ~b users Add users to Bcc list ~c users Add users to Cc list ~d Read in dead.letter file ~e Edit the message buffer ~m messages Read in messages, right-shifted by a tab ~f messages Read in messages, do not right-shift ~h Prompt for To list, Subject and Cc list ~p Print the message buffer ~q,~Q Quit, save letter in $HOME/dead.letter ~x Quit, do not save letter ~r file Read a file into the message buffer ~s subject Set subject ~t users Add users to To list ~v Invoke display editor on message ~w file Write message onto file ~. End of input ~!command Run a shell command ~|command Pipe the message through the command ~:command Execute regular mailx command ----------------------------------------------------------- Wow! So many commands . EOT %
You have mail
this indicates that there is email waiting in your mailbox. To read these messages type in mailx without any options.
% mailx mailx Revision: 70.7 Date: 92/04/16 15:39:44 Type ? for help. "/usr/mail/scot": 2 messages 1 unread >U 1 scot Sat Apr 2 12:52 13/352 A test of mail >U 2 scot Sat Apr 2 13:18 14/311 Another test of mail ? %Each message is preceded by a status letter. In this case I have 2 message that are unread (U). Use the ? to get help on the list of all mailx commands.
% mailx
mailx Revision: 70.7 Date: 92/04/16 15:39:44 Type ? for help.
"/usr/mail/scot": 3 messages 1 new
>U 1 scot Sat Apr 2 12:52 13/352 A test of mail
>U 2 scot Sat Apr 2 13:18 14/311 Another test of mail
? ?
mailx commands
type [msglist] print messages
next goto and type next message
edit [msglist] edit messages
from [msglist] give header lines of messages
delete [msglist] delete messages
undelete [msglist] restore deleted messages
save [msglist] file append messages to file
reply [message] reply to message, including all recipients
Reply [msglist] reply to the authors of the messages
preserve [msglist] preserve messages in mailbox
mail user mail to specific user
quit quit, preserving unread messages
xit quit, preserving all messages
header print page of active message headers
! shell escape
cd [directory] chdir to directory or home if none given
list list all commands (no explanations)
top [msglist] print top 5 lines of messages
z [-] display next [previous] page of 10 headers
[msglist] is optional and specifies messages by number, author, subject or
type. The default is the current message.
? t 2
Message 2:
From scot Sat Apr 2 13:18 EST 1994
Return-Path:
Received: by iriquois.eel.ufl.edu (1.37.109.8/4.09)
id AA16289; Sat, 2 Apr 1994 13:18:21 -0500
Date: Sat, 2 Apr 1994 13:18:21 -0500
From: "Scott Miller"
Message-Id: <9404021838.AA16289@iriquois.eel.ufl.edu>
To: scot
Subject: Another test of mail
Status: R
Wow! so many commands
?
Use the r key if you want to reply to this message and the d key if you want to
delete the message. When you are finished reading mail type in q to quit.
? q Held 2 messages in /usr/mail/scot %You can customize the mailx behavior by creating a $HOME/.mailrc file and setting options. See the man pages for more details.
% lpstat -t
scheduler is running
no system default destination
device for ps332: /dev/lp_ps332
ps332 accepting requests since Mar 14 16:07
printer ps332 is idle. enabled since Mar 14 16:07
fence priority : 0
%
We notice there is one printer on our network named ps332. Usually the printer name will
give some indication of its location and function. In this lab the ps stands for
postscript, lp stands for line printer and the number refers to the room location. The
lp command is used to send output to the printer, the -d (destination)
option is used to specify the printer destination.
% lp -dps332 mosaic.ps
request id is ps332-963 (1 file)
% lpstat -t
scheduler is running
no system default destination
device for ps332: /dev/lp_ps332
ps332 accepting requests since Mar 14 16:07
printer ps332 now printing ps332-963. enabled since Mar 14 16:07
fence priority : 0
ps332-963 scot priority 0 Mar 18 12:50 on ps332
mosaic.ps 2354 bytes
%
Notice that when we sent the file to the printer we receive a "request id". We can use this id to remove the print job from the printer queue. The cancel command will remove our print request.
% cancel ps332-963 request "ps332-963" cancelledNow our print job has been removed from the queue.
To use anonymous ftp use the login name of anonymous and then enter your email address as the password.
% ftp ftp.cica.indiana.edu Connected to winftp.cica.indiana.edu. 220 cica FTP server (Version wu-2.1c(7) Wed Feb 16 15:49:20 EST 1994) ready. Name (ftp.cica.indiana.edu:scot): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: 230-** 230-** You have reached ftp.cica.indiana.edu [129.79.26.27] at 230-** the Center for Innovative Computer Applications (CICA) at 230-** Indiana University in Bloomington, Indiana USA. 230-** 230-** To request automatic help, e-mail: ftp@cica.indiana.edu 230-** To contact us via e-mail: ftp-admin@cica.indiana.edu 230-** 230-** Windows files are located in /pub/pc/win3 230-** 230-** You are user 59 (of a maximum of 65 connections) in your 230-** user classification. 230-** 230-** Local time is: Wed Mar 30 20:22:17 1994 (Eastern) 230-** 230- 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp>You can see that this site limits the number of users to 65 connections. You are not always guaranteed a connection to an annonymous ftp site.
There are directories at anonymous ftp site that contain system programs that are of no use to someone looking for files. These directories are the /bin, /etc/ and /lost+found directories. The /dist and /pub directories usually contain usefull material. However, each ftp site is different. To determine what is at a site there is a file called README(or something similar) in the top level directory that gives brief description of what is there. Another file in directory called Index-byname.Z or possible ls-lR.Z contains a listing of every file that is located at the site. You can download these files and determine what directory contains the program you are looking for. The .Z at the end of the file means they are compressed and need to be uncompressed before they can be read. Table 7.10 shows some of the possible file extensions you might encounter at an ftp site.
Table7.10: Common FTP file extensions ----------------------------------------------------------------------------- .txt .TXT By itself, this means the file is a document, rather than a program. Use ascii transfer .ps .PS A PostScript document (in Adobe's page description language). You can print this file on any PostScript capable printer, or use a previewer, like GNU project's GhostScript. .doc .DOC Is another common suffix for documents. Use ascii transfer .z A file compressed by the Unix pack utility. It uses Huffman coding (which minimizes redundancy) on each byte. Type `unpack filename.z' or `gunzip filename.z' to decompress it. Use binary transfer. .Z This is a Unix compression method. To uncompress the file, type `uncompress filename.Z' or `gunzip filename.Z' and hit enter at your host system's command prompt. If it's a text file, you can read it online by typing `zcat file.txt.Z | more' at your host system's command line. Use binary transfer. .zip .ZIP These indicate the file has been compressed with a common MS-DOS compression program, known as PKZIP. Many Unix systems will let you un-ZIP a file with a program called, well, unzip. Use binary transfer. .gz The GNU project's compression format. A variant of the PKZIP format. Use `gunzip filename.gz' to uncompress. Use binary transfer. .zoo .ZOO A Unix, VAX and MS-DOS format. Requires the use of a program called zoo to uncompress. .Hqx .hqx A Macintosh format that needs BinHex for de-coding. .shar .Shar A Unix format. Use unshar. .tar Another Unix format, often used to glue several related files and/or complete directory trees into one big file. Use the tar command. Often, a "tarred" file will also be compressed with the .Z or .gz method, so you first have to use uncompress or gunzip and then tar. .TAZ .TGZ Sometimes used for compressed tar archives `.tar.Z', that are stored on "3 letter suffix only systems" (aka MS-DOS). .sit .Sit A Macintosh format, requires StuffIt. .ARC A DOS format that requires the use of ARC or ARCE. .LZH Another DOS compression format; requires the use of LHARC. .lz .lha The Amiga variant of LHARC. It's the most common Amiga archiving method, and made with the program lha or lz. ----------------------------------------------------------------------------- (NOTE: Parts of this table copied from the Big Dummy Guide to the Internet)