Linux network communication tools

Now is the age of the Internet, and you inevitably have to communicate with other users remotely and connect to remote hosts.
ping command

The ping command will send a response request to the host on the network, and according to the response information, you can determine whether the remote host is available.

The syntax of the ping command:
$ping hostname or ip-address
If the network is clear, you can see the response information soon.

For example, to check if it is possible to connect to Google's host:
quote
$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 the host is not responding, you can see a message similar to the following:
quote
$ping giiiiiigle.com
ping: unknown host giiiiigle.com
$

ftp tool

ftp is the abbreviation of File Transfer Protocol, called file transfer protocol. Through the ftp tool, files can be uploaded to a remote server, and files can also be downloaded from a remote server.

The ftp tool has its own commands (similar to Linux commands), which can:
connect and log in to a remote host;
view a directory, traverse the files in the directory;
upload or download files, including text files, binary files, etc.

The usage of the ftp command is as follows:
$ftp hostname or ip-address
Next, you will be prompted to enter the user name and password. After successful authentication, you will enter the home directory, and then you can use the commands of the ftp tool to operate.

ftp command description
put filename uploads the local file to the remote host.
get filename Download remote file to local.
mput file list uploads multiple local files to the remote host.
mget file list downloads multiple remote files to the local.
prompt off Turn off the prompt. By default, using the mput or mget command will constantly prompt you to confirm the upload or download of a file.
prompt on Opens a prompt.
dir lists all files in the current directory of the remote host.
cd dirname Changes the remote host directory.
lcd dirname Changes the local directory.
quit to log out.

Note that all uploads and downloads are for the current directory of the local host and the remote host. If you want to upload files in the specified directory, you must first cd to the directory before uploading.

Example of using ftp tool:
quote
$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   group        512 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   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 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 tool

The Telnet tool allows us to connect and log in to a remote computer.

Once connected to the remote computer, various operations can be performed on it, such as:
quote
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:>

The finger tool

finger allows us to view user information on the local host or remote host. Some systems disable the finger command for security reasons.

For example, to view native online users:
quote
$ finger
Login     Name       Tty      Idle  Login Time   Office
amrood               pts/0          Jun 25 08:03 (62.61.164.115)
View the information of the specified user of the machine:
quote
$ 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.
View online users on remote hosts:
quote
$ finger @avtar.com
Login     Name       Tty      Idle  Login Time   Office
amrood               pts/0          Jun 25 08:03 (62.61.164.115)
View information about a user on a remote host:
quote
$ 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.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326993099&siteId=291194637