Network communication utilities in Unix / Linux

When you work in a distribution environment then you need to communicate with remote users and you also need access to remote Unix devices.

When you work in a distribution environment then you need to communicate with remote users and you also need access to remote Unix devices.

There are a few Unix utilities that are especially useful for users who communicate in a distributed, networked environment. This chapter lists some of them.

Ping utility in Unix / Linux

The ping command sends an echo request to an available host on the network. Using this command you can check if your remote host is responding well or not.

The ping command is useful because:

Monitor and analyze hardware independence and software problems.

Determine the status of the network and other diverse foreign hosts.

Check, evaluate and manage the network.

Syntax in Unix / Linux

The following is a simple syntax to use the ping command:

 $ ping hostname or c ip - address 

The above command will start printing a response every second. To exit this command you can end it by pressing CTRL + C.

Example in Unix / Linux:

Here is an example to check the availability of a host on the network:

 $ 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 does not exist then it will run something like this:

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

Ftp utility in Unix / Linux

Here ftp stands for F ile T ransfer P rotocol. This utility helps you upload and download (upload and download) your files from one computer to another computer.

The ftp utility has its own set of settings in Unix as commands that allow you to perform tasks such as:

Connect and log in to a remote host.

Navigate folders;

List directory contents;

Set and receive files;

Transfer files in ASCII, EBCDIC or binary format.

Syntax in Unix / Linux

Here is a simple syntax to use ftp command:

 $ ftp hostname or c ip - address 

The above command will prompt you to enter your login ID and password. Once you have confirmed, you can access the main directory of the login account and you can perform various commands.

Some useful commands are listed below:

Description filename command Download a filename from the local device to the remote device get filename Download a filename down from the remote device to the internal device mput file list Download more than one file from the internal device to the device from far. mget file list Download more than one file from the device remotely to an internal device. prompt off Turn off the command prompt, by default you will be prompted to upload or download movies using the mput or mget command. prompt on Enable command prompt. dir Lists all files that are in the current directory of the remote device. cd dirname Change the directory to dirname on the remote device. lcd dirname Change directory to dirname on internal device. quit Exiting from the current login.

It should be noted that the files will be downloaded or uploaded to or from the current directory. If you want to upload your files in a separate folder, then first change to that folder and then upload the requested file.

Example in Unix / Linux:

Here is an example to illustrate some commands:

 $ 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 . x64 amrood group 1024 Mar 11 : 04 Mail drwxr - sr - x 2 amrood group 1536 Mar 3 18:07 Misc drwxr - sr - x 5 amrood group 512 Dec 7 10:59 OldStuff drwxr - sr - x 2 amrood group 1024 Mar 11 15 : 24 bin drwxr - x 5 amrood group 3072 Mar 13 16 : 10 mpl - rw - r - r - 1 amrood group 209671 Mar 15 : 57 myfile . out drwxr - sr - x 3 amrood group 512 Jan 5 13 : 32 public drwxr - sr - x 3 amrood group 512 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 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 utility in Unix / Linux

Sometimes you will need to connect to a remote Unix device and work on that device with remote control mode. Telnet is a utility that allows a computer user at a site to create a connection, log in, and then do the job on the computer at another site.

Once you log in using telnet , you can perform all operations on the device connected remotely. Here is an example of telnet:

 C :> amrood telnet . Trying com . 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 utility in Unix / Linux

The finger command displays information about users on a given host. Host can be internal or remote.

Finger may be powerless on other systems for security reasons.

Here is a simple syntax to use finger command:

Check all users who are logged on on the internal device as follows:

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

Get information about a separate user available on the internal device:

 $ 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 . 

Check all users who have logged in on the remote device as follows:

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

Get information about a particular user available on the remote device as follows:

 $ finger amrood @ avtar . com 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 . 

According to Tutorialspoint

Previous article: Process management in Unix / Linux

Next lesson: Micro editor in Unix / Linux

4 ★ | 2 Vote