Telnet job control

Source: Internet
Author: User

The telnet program contains many functions. We have also introduced a part in the previous article, such as its installation and testing, command control, and so on. Today, we will introduce the job control of the telnet program. What is job control? Now let's take a closer look.

Job Control

Unix systems support a function called Job control. It allows you to pause a program and work on another program, and then return to the first program. Here we will not discuss the Unix functions in detail, but we will introduce how telnet works with your system if there is job control. Enter the z command at the telnet prompt and then explain the meaning of the command name ). It will tell telnet to suspend work and return to "shell" to read and process your command program ). In this way, you can enter Common commands during the remote conversation.

Only when your shell supports job control can the z command work. If you use a modern shell, such as C Shell or Korn shell, it can work. However, if you are using a relatively old Bourne shell without job control, the z command will not work. In fact, the telnet program also "freeze" freeze ). The program you are currently running is called "foreground ". When you exit a program, we call it "background ".

When you enter the z command, the telnet program places itself in the background and allows you to return it to the local shelllocal shell), so that you can enter regular Unix commands at will. For example, you can check your email, display time, date, and so on. When you want to restore the remote connection, enter the following command:

Fg

This command tells the Unix System to re-enable the last interrupted program and place it on the foreground. Now you can restore the remote connection. You may wonder why the telnet job control command name is z? This is because, in Unix systems that support job control, you can press the susp pause) Key to place the current program in the background. Generally, the key is CTRL-Z. Therefore, the telnet command is named after the Unix key. If you do not perform any operations within a specified period of time, many hosts will automatically let you exit. For example, if you do not enter anything in a system within 15 minutes, the system will let you quit. Pay attention to this when you use the Z command to interrupt the telnet conversation. If you fail to resume the remote conversation within the specified time, the connection will be automatically disconnected.

At the beginning of the example, we log on to a computer named "nipper. You can see the shell prompt:

Nipper

At this prompt, enter a telnet command to connect to a remote computer named fuzzball .ucsb.edu:

Telnetfuzzball.ucsb.edu

Once the connection is confirmed, fuzzball displays the standard Unix logon prompt. We use the user ID harley to log on. Note that the entered password is not displayed to keep it confidential. After logon, the remote machine displays some information and a shell prompt is attached to it:

Fuzzball

Now we enter the data command to display the time and date.

 
 
  1. nippertelnetfuzzball.ucsb.edu  
  2. Trying...  
  3. Connected to fuzzball.ucsb.edu   
  4. Escape character is '^]'。  
  5. ULTRIX V4.2A Rev.47) fuzzball)  
  6. Welcome to the Fuzzball System  
  7. login: harley  
  8. Password:  
  9. Last login: Sun Apr 18 00:09:58 from nipper.com  
  10. fuzzball date  
  11. Sun Apr 18 00:24:54 CDT 1993  
  12. fuzzball CTRL-]  
  13. telnet> z  
  14. Stopped  
  15. nipper mail  
  16. No mail for harley  
  17. nipper fg  
  18. telnetfuzzball.ucsb.edu  
  19. fuzzball logout  
  20. Connection closed by foreign host。  
  21. nipper 

Next, we want to temporarily return to the nipper machine to check for emails. First, press CTRL-] to disconnect the remote connection and return it to telnet. You will see the prompt:

Telnet>

Then we enter the z command, which places the telnet program in the background. Now we can see the shell of the nipper

Prompt. Then run the mail command to check whether there is any electronic postal information. Enter the fg command. The response of the shell is to display the telnet command in the last command example that is placed in the background ). Shell then puts the program back to the foreground to automatically restore the remote connection. We will see the fuzzball shell prompt again.

Finally, we enter the logout command to exit from fuzzball. The remote connection is automatically closed and the telnet program exits. We will return to the beginning of the nipper shell prompt. In Unix systems, shell is a program that reads and processes your commands. There are many types of Unix shell, you can choose one. When shell is ready to receive commands, it will display a prompt. If you have an account on multiple computers, it is best to enter a prompt in a certain format so that it can contain the name of the computer ). In this way, your shell prompt can tell you which shell you are using at any time. By convention, the last character of the prompt represents the shell type you use. In this example, C-Shell is used. $ Indicates the Korn shell or the Bourne shell.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.