Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

UNIX communication tools


May 23, 2021 UNIX Getting started


Table of contents


Communication tools

If the user works in a distributed environment, the user needs to communicate with the remote user, and the user needs to access the UNIX host remotely.

Below are some of the utilities in UNIX operating systems that are dedicated to network communication between users in distributed environments.

Ping tool

The ping instruction sends an answer request to a host on the network. T his instruction is primarily used to detect whether the remote host can communicate properly.

Ping instructions can be used for the following purposes:

  • Track and distinguish hardware or software problems.
  • Determine the status of the network and remote hosts.
  • Testing, measurement, or network management.

Grammar

Here's the syntax for using the ping instruction:

    $ping hostname or ip-address

The above designation continuously prints the response message. The user can press the CTRL - C button at the same time to end the printing of the information.

Example

Here's an example of detecting whether a host in your network is reachable:

    $ping google.com
    PING google.com (74.125.67.100) 56(84) bytes of data.
    64 bytes from 74.125.67.100: icmp_seq=1 ttl=54 time=39.4 ms
    64 bytes from 74.125.67.100: icmp_seq=2 ttl=54 time=39.9 ms
    64 bytes from 74.125.67.100: icmp_seq=3 ttl=54 time=39.3 ms
    64 bytes from 74.125.67.100: icmp_seq=4 ttl=54 time=39.1 ms
    64 bytes from 74.125.67.100: icmp_seq=5 ttl=54 time=38.8 ms
    --- google.com ping statistics ---
    22 packets transmitted, 22 received, 0% packet loss, time 21017ms
    rtt min/avg/max/mdev = 38.867/39.334/39.900/0.396 ms
    $  

If a host is not reachable, the following information is displayed:

    $ping giiiiiigle.com
    ping: unknown host giiiiigle.com
    $  

FTP tool

FTP is short for File Transfer Protocol. Use this tool to help users upload or download files between hosts.

The FTP tool has its own UNIX instructions that can do the following:

  • Link and log on to the remote host.
  • Browse the catalog.
  • List the contents of the catalog.
  • Upload or download files.
  • Transfer files ascii, ebcdic, or binary.

Grammar

Here's the syntax for using the ftp instruction:

    $ftp hostname or ip-address

The above instructions trigger a login interface that enters the account number and password. If the account number and password entered by the user are authenticed, the user can access the root of the account entered accordingly, and then a variety of actions can be performed.

Here are some common actions:

Instructions Describe
put filename Upload files locally to the remote server
get filename Download files locally from the remote server
mput file list Upload files in bulk from local to remote servers
mget file list Download files locally in bulk from the remote server
prompt off Close file reminders so that every file is not asked for every time you operate mput and mget.
prompt on Turn on file reminders
dir Lists all files in the current directory on the remote server
cd dirname Switch the directory on the local host to the specified directory
lcd dirname Switch the directory on the remote server to the specified directory
quit Sign out of the current landing

It is important to note that the local host directory is the current directory when the files are uploaded and downloaded. I f the user wants to upload or download a file's directory as a specific directory, the user needs to switch the current directory to the specified directory before uploading or downloading.

Example

Here are some examples of ftp operations:

    $ftp amrood.com
    Connected to amrood.com.
    220 amrood.com FTP server (Ver 4.9 Thu Sep 2 20:35:07 CDT 2009)
    Name (amrood.com:amrood): amrood
    331 Password required for amrood.
    Password:
    230 User amrood logged in.
    ftp> dir
    200 PORT command successful.
    150 Opening data connection for /bin/ls.
    total 1464
    drwxr-sr-x   3 amrood   group   1024 Mar 11 20:04 Mail
    drwxr-sr-x   2 amrood   group   1536 Mar  3 18:07 Misc
    drwxr-sr-x   5 amrood   group512 Dec  7 10:59 OldStuff
    drwxr-sr-x   2 amrood   group   1024 Mar 11 15:24 bin
    drwxr-sr-x   5 amrood   group   3072 Mar 13 16:10 mpl
    -rw-r--r--   1 amrood   group 209671 Mar 15 10:57 myfile.out
    drwxr-sr-x   3 amrood   group512 Jan  5 13:32 public
    drwxr-sr-x   3 amrood   group512 Feb 10 10:17 pvm3
    226 Transfer complete.
    ftp> cd mpl
    250 CWD command successful.
    ftp> dir
    200 PORT command successful.
    150 Opening data connection for /bin/ls.
    total 7320
    -rw-r--r--   1 amrood   group   1630 Aug  8 1994  dboard.f
    -rw-r-----   1 amrood   group   4340 Jul 17 1994  vttest.c
    -rwxr-xr-x   1 amrood   group 525574 Feb 15 11:52 wave_shift
    -rw-r--r--   1 amrood   group   1648 Aug  5 1994  wide.list
    -rwxr-xr-x   1 amrood   group   4019 Feb 14 16:26 fix.c
    226 Transfer complete.
    ftp> get wave_shift
    200 PORT command successful.
    150 Opening data connection for wave_shift (525574 bytes).
    226 Transfer complete.
    528454 bytes received in 1.296 seconds (398.1 Kbytes/s)
    ftp> quit
    221 Goodbye.
    $

Telnet tools

Users often experience the need to connect to a remote UNIX host and to operate on a remote host. Telnet is a tool that allows users to connect, log on, and operate remotely on remote servers.

Once a user logs on to a remote server using the Telnet tool, the user can operate the remote server to perform tasks as if it were a local host operation. Here's an example of a Telnet conversation:

    C:>telnet amrood.com
    Trying...
    Connected to amrood.com.
    Escape character is '^]'.

    login: amrood
    amrood's Password: 
    *****************************************************
    *   *
    *   *
    *WELCOME TO AMROOD.COM  *
    *   *
    *   *
    *****************************************************

    Last unsuccessful login: Fri Mar  3 12:01:09 IST 2009
    Last login: Wed Mar  8 18:33:27 IST 2009 on pts/10

       {  do your work }

    $ logout
    Connection closed.
    C:>    

Finger tool

The finger directive is used to display information about the user on the specified host. T he host here can be between a local host and a remote server.

For security reasons, finger can also be used in other systems.

Here's a simple syntax for using the finger instruction.

An example of detecting information about a densoed user in a local host is as follows:

    $ finger
    Login Name   Tty  Idle  Login Time   Office amrood   pts/0  Jun 25 08:03 (62.61.164.115)   

Here's an example of getting information about a valid user specified on the local host:

    $ finger amrood
    Login: amrood   Name: (null)
    Directory: /home/amrood Shell: /bin/bash
    On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
    No mail.
    No Plan.   

An example of detecting information about all landing users in a remote server is as follows:

     $ finger @avtar.com
    Login Name   Tty  Idle  Login Time   Office
    amrood   pts/0  Jun 25 08:03 (62.61.164.115)   

Here's an example of getting the specified valid user information on a remote server:

    $ finger [email protected]
    Login: amrood   Name: (null)
    Directory: /home/amrood Shell: /bin/bash
    On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
    No mail.
    No Plan.