Linux common network command

xiaoxiao2021-03-17  181

Linux common network command (reproduced)

Blue forest http://www.lslnet.com

The main advantage of the computer network is to achieve resource and information sharing, and the user can access information remotely. Linux provides a set of powerful network commands to serve users, which help users log in to remote computers, transfer files and execute remote commands. This chapter describes the following commonly used orders:

FTP transfer file

Telnet logins to remote computers

r - use various remote commands

NetStat View the status of the network

Nslookup query domain name and IP address

Finger querying the information of a user

PING Query if a machine is working

Remote file transfer with the ftp command

The ftp command is a user interface for a standard file transfer protocol. FTP is a simple and efficient way to transfer files between computers on the TCP / IP network. It allows users to transfer ASCII files and binary files. During the FTP session, the user can connect to another computer using the FTP client. Since then, the user can move up and down in the directory, list the directory content, copy the file from the remote machine to the local machine, transfer the file from the local machine to the remote system.

It should be noted that if the user does not have the access permission of that file, you cannot obtain a file from the remote system or transfer files to the remote system. In order to use FTP to transfer files, the user must know the legal username and password on the remote computer. The combination of this username / password is used to confirm the FTP session and to determine what kind of access can be made to the user to transfer. In addition, users clearly need to know the name or IP address of the computer that performs FTP sessions.

The FTP command function is to transfer the file between the local machine and the remote machine. The general format of this command is as follows:

$ FTP hostname / IP

The "hostname / IP" is the host name or IP address of the remote machine to be connected. In the command line, the host name belongs to the option. If the host name is specified, the FTP will try to connect with the remote machine's FTP service; if no hostname is specified, the FTP will give a prompt, waiting for the user to enter command: $ ftp ftp> At this point, enter the OPEN command to add the host name or IP address after the FTP> prompt, and will try to connect the specified host. Regardless of which method is used, if the connection is successful, you need to log in to the remote machine. If you have an account on the remote machine, you can use this account through FTP and provide a password.

The read and write permission on the user account on the remote machine determines what files can be downloaded on the remote machine and put the upload file in which directory. If there is no dedicated login account for a remote machine, many FTP sites have a special account that can be used. This account is named Anonymous (also known as anonymous FTP). When using this account, you request an Email address as a password. If the remote system provides an anonymous FTP service, users can log in to special, for public use.

Generally gives two directory: PUB directory and incoming directory. The PUB directory contains all files that the site is available for public, and the file is stored on the site. Once the user logs in to the remote site, the "FTP>" prompt will be obtained. Now you can use the command provided by the FTP, you can use the HELP command to get the list of commands available, or you can specify the specific command name after the HELP command, and you can get the description of this command.

The most commonly used commands are:

Ls lists the current directory of the remote machine

CD Change the work directory on the remote machine

LCD changes the work directory on the local machine

ASCII Settings File Transfer Method for ASCII Mode

Binary settings file transfer mode is binary mode

Close terminates current FTP sessions

Hash displays one ## each time the data in the data buffer is transmitted.

Get (MGET) transmits the specified file from the remote machine to the local machine

PUT (MPUT) transmits the specified file from the local machine to the remote machine OPEN connection remote FTP site

Quit disconnects the connection with the remote machine and exits the FTP

? Display local help information

! Go to the shell

The following is a brief introduction to the FTP common command.

The FTP session open command is used to open a session with the remote host. The general format of this command is that Open Host Name / IP If you want to connect with more than one site during the FTP session, you usually use only the FTP command without parameters. If you just want to connect with a computer during the session, specify the remote host name or IP address as the parameter of the FTP command on the command line. Termination FTP session close, disconnect, quit, and bye commands are used to terminate sessions with remote machines. The close and the disronnect command turn off the connection with the remote machine, but allows the user to stay in the FTP program of the local computer. The quit and bye commands are turned off the user with the remote machine, and then exit the FTP program on the user machine. Changing the Directory "CD [Directory] command to change the directory on the remote machine during the FTP session, the LCD command changes the local directory, and the user can specify the location of the field file. The remote directory list ls command lists the contents of the remote directory, just like using an LS command in interactive shell. The general format of the LS command is: LS [Contributory] [Local File] If the directory is specified as a parameter, then LS lists the contents of the directory. If the name of a local file is given, then this directory list is placed in this file you specified on the local machine. Gets the file GET and MGET commands from the remote system to get files from the remote machine. The general format of the GET command is: Get file name You can also give a local file name, this file name is the file name that this file is created on your local machine. If you don't give a local file name, then use the remote file original name. Mget Commands Get multiple remote files at a time. The general format of the MGET command is: the MGET file name list uses a file name list separated by spaces or band-through to specify the file to be acquired, and each file of it requires the user to confirm whether to transmit. Send a file PUT and MPUT command to the remote system to send files to the remote machine. The general format of the put command is: the PUT file name mput command sends multiple local files at a time, the general format of the mPut command is: the MPUT file name list uses a file name list separated by spaces or band-through-bands to specify the files to send. Each file of it requires the user to confirm whether to send. Change file transfer mode By default, FTP Press the ASCII mode to transfer files, and users can specify other modes. The function of the ASCII and the brinary command is to set the transmission mode. Transport files with ASCII mode is very good for plain text, but in order to avoid damage to binary files, users can transfer files in binary mode. Checking the transfer status to transmit large files, it is very useful to find that the FTP provides feedback information about the transmission situation. After the Hash command enables FTP to print a # character on the screen after the data in the data buffer is transferred each time. This command can be used when sending and receiving files. The local command in the ftp When you use FTP, the character "!" is used to transfer a command to the command shell on the machine. If the user is in the FTP session, it is useful if shell is doing something. For example, the user has to build a directory to save the received file. If you enter! Mkdir new_dir, Linux creates a directory called New_DIR in the current local directory.

The typical conversation process of downloading the binary data file from the remote machine GruntHOS is as follows:

$ Ftp grunthos Connected to grunthos 220 grunthos ftp server Name (grunthos: pc): anonymous 33l Guest login ok, send your complete e-mail address as password Password:. 230 Guest 1ogin ok, access restrictions apply Remote system type is UNIX.. ftp> cd pub 250 CWD command successful. ftp> ls 200 PORT command successful. l50 opening ASCII mode data connection for / bin / 1s. total ll4 rog1 rog2 226 Transfer comp1ete. ftp> binary 200 type set to I. ftp> hash hash Mark Printing on (1024 BYTES / HASH MARK). FTP> Get Rog1 200 Port Command SuccessFu1. 150 Opening Binary Mode Data Connection For Rogl (L4684 Bytes). # # # # # 226 Transfer Complete. 14684 BYtes Received in 0.0473 SECS (3e 02 kbytes / sec) ftp> quit 22l goodbye. Use the telnet command to access the remote computer

User users use the Telnet command for remote login. This command allows users to communicate between remote computers using Telnet protocols, and users can log in to remote computers over the network, just like logging in to the local machine. To log in to the remote computer via Telnet, you must know the legal username and password on the remote machine. Although some systems do login functionality for remote users, for security considerations, to limit the operation permissions of the guests, so that the function can be used in this case. When the remote user is allowed to log in, the system usually places these users in a restricted shell to prevent the system to be damaged by malicious or accidentally. Users can also log in to their own computers using Telnet, check email, editing files, and runners, just like locally logging in.

However, the user can only use the terminal-based environment rather than the X Wndows environment, Telnet only provides terminal simulation to ordinary terminals without supporting X Wwwwow graphics environments. The general form of the telnet command is: Telnet hostname / IP where "hostname / IP" is the host name or IP address to which you want to connect. If this command is executed, you will get the login: prompt from the remote machine. The process of logging in using the telnet command is as follows: $ TELNET Host Name / IP Start Telnet session. Once the Telnet is successfully connected to the remote system, the login information is displayed and the user name and password will be losed. If the user name and password are entered correct, you can successfully log in and work on the remote system. After the Telnet prompt, you can enter a lot of commands to control the Telnet session, which has a detailed description of these commands in the Telnet online help manual.

Below is a Telnet session on a Linux computer:

$ Telnet Server. com true 107.0.0.1 ... Connected to Serve. Somewhere. com. Escape character is / '?] /'. "TurboLinux Release 4.0 (Colgate) kernel 2.0.18 on AN i486 login: Bubba Password : Last Login: Mon Nov L5 20:50:43 for localhost Linux 2. 0.6. (POSIX). Server: ~ $ server: ~ $ logout connection closed by Foreign Host $ User After ending the remote session, be sure to use Logout The command exits the remote system. Then the Telnet reports the remote session is turned off and returns to the user's locker's shell prompt. The R-series command can access the remote computer using the R-series command in addition to FTP and Telnet. Exchange file. Use the R-series command to pay special attention, because if the user is not careful, it will cause serious security vulnerabilities. After the user issues a R-series command, the remote system checks the file named /etc/hosts.equiv/Hosts.equiv, Check whether the user's host is listed in this file. If it does not find the host's host, check the file named. Rhosts on the main directory of the same name on the remote machine, see if the user's host is included. If the user's host includes In any of these two files, the user does not have to provide a password without providing the R-series command.

Although users do not need to type in the remote machine each time, it may be very convenient, but it may also bring serious security issues. We recommend that users carefully consider the security issues implied by R-commands before establishing /etc/hosts.equiv and.rhosts files.

Rlogin command

Rlogin is an abbreviation for "Remote Login". This command is very similar to the telnet command, allowing the user to launch interactive command sessions on remote systems. Rlogin's general format is:

Rlogin [-8EKLDX] [-e char] [-k realm] [- l username] Host

The general most commonly used format is: rlogin host The meaning of each option in this command is:

-8 This option always allows 8-bit input data channels. This option allows you to send formatted ANSI characters and other special codes. If this option is not used, the parity bit will be removed unless the termination of the far end and the starter character is not or or otherwise.

-E stops regarding any characters as a escape character. When you are working with the -8 option, it provides a complete transparent connection.

-K Close all Kerberos confirmation. This option is only used when connecting to a host connection using the Kerberos confirmation protocol.

-L allows the Rlogin session to run in the Litout mode. For more information, please consult the TTY online help.

-d opens Socket debugging of TCP sockets that communicates with the remote host. For more information, please refer to the online help of SetsockOpt.

-e is an Rlogin session setting escape character, the default escape character is "~", the user can specify a text character or an eight-input number in the form of // nnn.

-K request rlogin's Kerberos license for remote hosts in the specified area, rather than obtaining Kerberos licenses for remote hosts within a remote host area determined by KRB_REALMOFHOST (3).

-x Open DES encryption for all data transmitted through the Rlogin session. This will affect the response time and the CPU utilization, but can improve security.

RSH command

RSH is an abbreviation for "Remote Shell". This command launches a shell on the specified remote host and executes the command specified in the RSH command line. If the user does not give the command to be executed, RSH uses the rlogin command to log in to the remote machine. The general format of the RSH command is:

RSH [-kdnx] [-k realm] [-l username] host [command]

The generally common format is:

RSH Host [Command]

Command can be any Linux command from the Shell prompt.

The meaning of each option in the RSH command is as follows:

-K Close all Kerbero confirmation. This option is only used when connecting to a host confirmed using Kerbero.

-d opens Socket debugging of TCP sockets that communicates with the remote host. For more information, please refer to the online help of SetsockOpt.

-k request RSH to get the Kerberos license for the remote host in the specified area, not the Kerberos license of the remote host in the remote host area determined by KRB_RELMOFHOST (3).

-l By default, the remote username is the same as the local username. This option allows the remote user name to be specified. If the remote username is specified, use Kerberos confirmation and is the same as in the rlogin command.

-n redirects from special equipment / dev / null input.

-x Open DES encryption for all data transmitted. This will affect the response time and the CPU utilization, but can improve security. Linux places the standard input into the RSH command and copy it to the standard input of the command to be executed remotely. It copies the standard output of the remote command to the standard output of RSH. It also copies remote standard errors into local standard error files. Any exit, abort and interrupt signals are sent to the remote command. When the remote command is terminated, the RSH will terminate.

RCP command

RCP represents "Remote File Copy". This command is used to copy files between computers.

There are two formats in the RCP command. The first format is used for files to files; the second format is used to copy files or directories into another directory.

The general format of the RCP command is:

RCP [-px] File1 file2 rcp [-px] [-r] [-k realm] file

Directory Each file or directory parameter can be either a remote file name or a local file name. The remote file name has the following form: RNAME @ rhost: path, where RNAME is a remote username, Rhost is a remote computer name, and Path is the path of this file.

The options of the RCP command are as follows:

-r recursively copy all the contents of the source directory to the destination directory. To use this option, the purpose must be a directory.

-p Attempts to reserve the modification time and mode of the source file, ignore Umask.

-K request RCP to get the Kerberos license for the remote host within the specified area, not the Kerberos license for the remote host within the remote host area determined by KRB_RELMOFHOST (3).

转载请注明原文地址:https://www.9cbs.com/read-129527.html

New Post(0)