Unix - Telnet & FTP
TechNotes      |     Unix Home

 

    Telent and FTP protocols are the two ways of accessing a unix server. You can use 3rd party vendor tools (such as Hummingbird's Exceed or the FTP & Telnet utility programs provided by Windows, etc.) or you can use a unix command line to access other servers through telnet and ftp.
Telnet Protocols
(user interface to a remote system)
 
telnet
The telnet utility communicates with a unix host using the TELNET protocol. If telnet is invoked without arguments, it enters command mode, indicated by its prompt (telnet> ). In this mode, it accepts and executes its associated commands.
 
Telnet is typically used by a user to access and login to a unix box from a remote system (their workstation or another unix server). From a windows workstation there are a variety of tools that can be used to access a unix box. Hummingbird's Exceed Suite of tools contains a Telnet and FTP utility that are both easy to use. Windows operating systems come with their own telent and FTP utilities. And there are still several other packages on the internet.
 
To execute a telnet session from a unix console (or another telnet session),
  1. > telnet boxname
ie: telent abcbox100
You'll be prompted to login with your user id and password. Once you have been authenticated, you are now communicating with the new host. Any commands you invoke in this session will be on this box, not on the origination or host server you were on.
FTP Protocols
(File Transfer Programs)
 
ftp
The ftp command is the user interface to the Internet standard File Transfer Protocol (FTP). ftp transfers files to and from a remote network site. The host and optional port with which ftp is to communicate may be specified on the command line. If this is done, ftp immediately attempts to establish a connection to an FTP server on that host. Otherwise, ftp enters its command interpreter and awaits instructions from the user. When ftp is awaiting commands from the user, it displays the prompt ftp>.
 
FTP is used by a user to transfer files from a remote system (their workstation or another unix server) to a unix host. From a windows workstation there are a variety of tools that can be used to access a unix box for FTP. Hummingbird's Exceed Suite of tools contains a Telnet and FTP utility that are both easy to use. Windows operating systems come with their own telent and FTP utilities. And there are still several other packages on the internet. One of the more common FTP tools for web developers for instance is a freeware package called WS_FTP, by ISPWitch. You can down load it at: www.ftpplanet.com/download.htm (for more information see Using FTP Witch).
FTP Commands
You can also use FTP between unix sessions. The following are a few of the basic and most commonly used commands. You may want to review the online man page for FTP for more information and details.
 
To execute a ftp session from a unix console (a telnet session).
  1. > ftp boxname
ie: ftp abcbox100
You'll be prompted to login with your user id and password. Once you have been authenticated you can use various ftp commands to navigate and transfer files.
 
Many of the same unix telnet commands function the same in a FTP session.
  1. To change directories: > cd /directory-path
  2. To show the current directory: > pwd
  3. To show the files listed in the current directory: > ls -al
  4. To make a directory: > mkdir directory-name
  5. To exit the FTP session: > quit
 
Another helpful command is the local change directory command. This allows you to change directories on the host server (the server you initiated the ftp session from).
  1. > lcd pathname
ie: lcd /www/apache/conf/
FTP get files from a host
It's important to remember which box is the host and which is the client. The host is the box you initated the FTP command on. The "from" box (box A). The client is the unix box you FTP'd to. The "to" box. (box B)
 
 
When you want to bring files from the client box to the host box, you'll use a "get" command. You're getting files from somewhere to bring them back to the box you want them to be on. The easiest way to do this is to:
  1. be residing in the directory you want the files to be copied to on the host server (box A).
  2. FTP to the client (box B) while you're in that directory on box A,
  3. navigate to the appropriate directory on the client server
  4. and "get" the files you want.
You can also use full path commands, but if you're getting more than one file, that can be time consuming.
 
When you're ready to get the file(s):
  1. > get filename
This will copy the file you specified from the client server (box B) to the directory you're residing in on the host server (box A).
FTP put files onto a host
When you want to put files from the host server to the client server, you'll use the "put" command. You're copying files from here and "putting" them over there. The easiest way to do this is to:
  1. be residing in the directory where the files to be copied exist on the host server (box A).
  2. FTP to the client (box B) while you're in that directory on box A,
  3. navigate to the appropriate directory on the client server
  4. and "put" the files you want copy to the new box.
You can also use full path commands, but if you're putting more than one file, that can be time consuming.
 
When you're ready to put the file(s):
  1. > put filename
This will copy the file you specified from the host server (box A) to the directory you're residing in on the client server (box B).