Allows Unix terminals to act with users

Source: Internet
Author: User
Tags uppercase character
Article Title: Let Unix terminals move with users. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In Windows, you can also perform some simple settings on the terminal. For example, you can set a shortcut for the input method. However, in Windows, this terminal has very few settings. In the Unix operating system, you can set many features of the terminal for your convenience. As long as you are interested, you may have encountered similar phenomena in your actual work. For example, in some Unix operating systems, a single character can be deleted using the return key, but not in some operating systems. This situation occurs even in shell of the same version. In fact, this is not a problem with the keyboard, but caused by the personalized settings of the terminal. Sometimes System Engineers need to adjust Unix terminal settings to adapt to their work habits. Unix manages a terminal as a file, so many parameters can be set, basically including all features related to the terminal. However, there are not many actually used by system engineers, mainly including the following aspects.

1. Can I exit the application by pressing Ctrl + C.

Whether it is a Unix operating system or a Linux operating system, sometimes the command cannot respond. Or, because the running time is relatively long, it exceeds the endurance time of System Engineers. In this case, you can usually use the Ctrl + C key to interrupt the process and run commands. However, some System Engineers do not use this combination key. Because they are used to Microsoft products. In Microsoft notepad or Word files, this command is used to copy text. Now they want to interrupt the command line, and they are easy to confuse. For this reason, some system engineers prefer to mask the screen. In Unix systems, this function is controlled by the keyword intr. To disable this function, run the stty command. However, I suggest that you do not need to change this keyword. Otherwise, you cannot force exit when you really need to launch a running command.

If you need to restart this command, you can use stty intr \ ^ c to set it. Intr is the keyword that controls this function. The two symbols have special meanings in the system. In Unix, you need to set a terminal keyword value. Here, the \ backslice is used, rather than equal signs or other symbols. In addition, ^ is called a delimiters in Unix systems. In the era of terminal keyword setting, the table uses the ctrl key on the keyboard. The final character c Represents the c key on the keyboard. However, it should be noted that this is a careful character c, rather than an uppercase character. The above command tells the operating system to use the Ctrl + c key as the interrupt symbol.

2. Set the end symbol of the file.

In Unix operating systems, sometimes there are more text operations than graphical operations. In particular, the Unix operating system is managed as a server. Generally, the operating system is started in text mode rather than graphical mode. This not only improves the efficiency of the server, but also improves its stability. However, using the text mode to manage the operating system poses some challenges for many System Engineers, because the relevant operations must be completed through the keyboard. For example, when writing an email, all operations are completed by keyboard. At this time, a file will be encountered. How can I tell the operating system that the text input has been completed? For example, if you write an email in text mode, you need to tell the operating system that you can end the keyboard input operation. For example, when using the cat command to create a file, you also need to manually tell the operating system that the file content has been completed. At this point, the system engineer can use Ctrl + a to tell the operating system. The keyword corresponding to this function in the system is eof (File Terminator ). If the system engineer is not familiar with this key combination, he can use the command stty to change it. For example, some System Engineers transferred from Microsoft use Ctrl + e to indicate the file Terminator, I don't like to use this Ctrl + a key (this may indicate the meaning of the entire selection in Microsoft products ). You can use this command to set stty eof \ ^ e. Similar to the preceding command, the keyword is different. However, when changing these terminal operation symbols, you must avoid using the same terminal operation symbols. Otherwise, some inexplicable problems may occur.

 3. Whether the Escape key allows the deletion of characters.

There are two keys on the keyboard. One is the del key, which is used to delete characters backward. The other is the return key, which is used to delete the character forward. However, sometimes System Engineers will find that the return key does not work, and it cannot delete characters backward. In addition to eliminating keyboard faults, it is often a fault caused by the terminal configuration. In the terminal configuration, there is a keyword called echoe, which is used to control whether to allow the use of the backspace key to delete characters backward. However, this setting is different from the preceding setting method. If you want to disable this function, you need to use stty? Echoe command. Use the stty echoe command to enable it.

In fact, in Unix operating systems, terminal-related keywords are expressed in two forms: KEYWORDS = A value or keywords (-keywords. The value settings of these two forms of keywords are different. As mentioned above, the display format of the mid-range symbol in the system is keyword = the format of a value (intr = ^ c ). The keyword in this format needs to be adjusted by \ ^. You can reset the function key. The keyword of the current backspace function is echoe, and its display format is keyword (-Keyword ). This type of keyword is also called the switch keyword. That is to say, it is only enabled or disabled. It cannot be replaced by other content. It is relatively easy to adjust the value of a keyword of this type. You only need to use the form of the stty (-) keyword. If there is no minus sign before the keyword, this function is enabled. If there is a minus sign, this function is disabled. If the system engineer cannot use the backspace key, use the stty command first? A command to view the configuration of the current terminal. In particular, you need to pay attention to this echoe keyword to see if there is a minus sign before it. If any, it indicates that a character cannot be deleted from the forward using the return key. In this case, System Engineers can use stty echoe to enable this function. Generally, you do not need to log out of the system or close the current session. This setting takes effect. Different shells have different default settings for the Return key. Therefore, for ease of operation, System Engineers sometimes need to adjust the function of this backspace key to ensure that all versions of shell can use this function or disable this function.

[1] [2] Next page

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.