-->

Previous | Table of Contents | Next

Page 208

Connecting with Other Computers with the telnet
Command

You can use the telnet command to log in to remote computers to run programs, view files, or download data. The telnet command has a number of options, but is generally used with a hostname, or remote computer system's name, on the command line to start a telnet session, for example:


# telnet computer.somewhere.com

This command will connect you to the remote computer, and you'll receive a login prompt. You'll generally need to have a username and password in order to enter the remote system. For security reasons, few computer systems allow unknown users anonymous access. You may be able to find a list of computer systems providing access by using your favorite search engines, such as through a Web search site.

TIME SAVER
If you've "telnetted" to a remote computer system through an active Internet connection, or through a shell account through a direct dial-in to the computer, you can easily transfer programs using the sz and rz (send and receive) programs (if those programs are resident on the remote computer). After you've dialed in to a remote computer directly through the phone line, you can transfer files to your computer with: sz -w 2048 filename.tgz.
This command will send the file filename.tgz using the ZMODEM communications protocol. Your communications program should automatically start receiving the file using this protocol (most communications programs, anyway). If you're connected through an Internet connection, the companion program, rz, should be automatically started to receive the file. If not, you can start the rz program manually. See the sz and rz manual pages for more information.

You may also run the telnet command in an interactive mode, opening and closing sessions to different remote computers. Like the ftp command, the telnet command has built-in help. If you'd like to get a list of available help topics, you can use the question mark (?), for example:


# telnet

telnet> ?

Commands may be abbreviated.  Commands are:



close           close current connection

logout          forcibly logout remote user and close the connection

display         display operating parameters

mode            try to enter line or character mode (`mode ?' for more)

open            connect to a site

quit            exit telnet

send            transmit special characters (`send ?' for more)

Page 209


set             set operating parameters (`set ?' for more)

unset           unset operating parameters (`unset ?' for more)

status          print status information

toggle          toggle operating parameters (`toggle ?' for more)

slc             change state of special charaters (`slc ?' for more)

auth            turn on (off) authentication (`auth ?' for more)

z               suspend telnet

environ         change environment variables (`environ ?' for more)

?               print help information

telnet>

If you'd like to experiment with this command without an active Internet connection, you can telnet to your own computer from a terminal window under X11, or through the console. As with the ftp command, you should first determine the hostname of your computer with the hostname command, then either specify the hostname on the telnet command line, or run telnet, and use its open command to start the session, for example:


#  hostname

localhost.localdomain

# telnet localhost

Trying 127.0.0.1...

Connected to localhost.

Escape character is `^]'.



Welcome to Red Hat Linux!

Kernel 2.0.31 on an i586

login: bball

Password:

Last login: Fri Dec 12 16:51:44 on tty1

#

As you can see, after entering the username and password at the login prompt, you'll be presented with the shell prompt command line.

Page 210

Previous | Table of Contents | Next