Set-o VI Aix under shell

Source: Internet
Author: User

Set-o VIYou can use the last command with the Esc+k key again.

Esc+k
Esc+j
Upside Down


Ksh default is Emacs style. Set-o Emacs

Use the commands you've already used under AIX

Used under AIX, the default shell is Ksh, unlike bash under Linux, he can't use the DOS keys we're already familiar with, or other shortcuts we've already been familiar with, using the commands we've used last time, For example, in the DOS command state (I put my own frequently used shortcut keys listed, and possibly other, slowly add), you can get through the F7 to obtain you already entered in the current DOS window of the non-repeating command (Windows to your own in the order of the current window input of the distinct command to sort, to 0, ... To number), F1 repeats the last character in the same position, F3 repeats all the last commands, F5 and F8 up the command I have entered, and F9 is able to enter the non-duplicated command ID of the last input you want to display (for example, after entering a DOS window, I entered two commands sequentially: Dir and CD Test, then the No. 0 command of this window is dir, and so on, when I press F9, the system prompts me to "Enter the command number", this time I followed the last input sequence number input can, for example, choose 0 then this is the dir command, this function and F7 function is consistent, Just F7 can choose, F9 can be directly input, these two functions when you enter the command longer time is more useful).
To use the last command you have used in AIX, you can use the following methods:
1, in Ksh, run Set-o VI, this time the entire command state is the VI editor, the operation of the method and VI editor A touch, to repeat the last command, in the current status bar press ESC, and then enter K, you can see the next command, press K can query the previous command, H can move forward one character in the current line, and L can move backward one character in the current line, which is equivalent to the state of VI, and all commands for single-line operations in the VI state can be used. Just press ENTER when you're done editing.
2, if not under the Ksh, then you can run under the command Window Ksh-o VI, the other commands and the first method of the same
3, set the EDITOR=VI in KSH environment variable, the method of modification is to add Editor=vi;export editor directly in the. Profile.
4, delete the history command, can be in the current user's home directory, query to a. sh_history file, which contains all of your current user input commands. You can edit the file and then delete the command. Of course, you can put your favorite commands or longer commands in the inside, and then you can directly call on it. Of course, from this document can see the above points of the use of VI command to obtain the last command, in fact, Ksh is to obtain the information in this file.
5, the following tips:
A. Repeat the previous command to enter R directly in the Ksh state
b, you can execute R a=b in Ksh state, meaning that the a character in the previous command is replaced with the B character and then run.

////////////////////

The reason later on the Internet to check, for a moment, quote "FreeBSD use Daquan" in a section of content:

-----------------------------------------------------------------------------------------------

    • Configure the user shell

In fact, SH and csh are not the best choice for the average user, because these two shells do not work well in terms of ease of use, such as the command line editing function is not strong, can not use the Hot Key Redo command and so on. Newer shells, such as bash and tcsh, have these user-friendly features, but you must install these shell programs before you can change the shell settings of the normal user to use these shell programs. You can use PW, VIPW, or chsh to change the shell of your user.

The two shells do not conform to the SH and csh style, so liking csh can choose Tcsh, and likes the SH style's Choice bash. In addition to these two shells, there are also Ksh, zsh and other shells to choose from. If you don't have a preference for two shells, you can choose Bash, which is a GNU software that is much more powerful than the standard SH function.

With these two enhanced shells, you can use the command line editing functionality provided by the shell. According to the different habits, you can choose the way of editing the vi style or Emacs style, the default is Emacs mode, this way use the direction key to retrace the command, and modify, and VI style using the letter command for editing keys, such as the use of H, J, K, L four keys to move the light target, The best thing about VI is that it does not use a control key other than the basic keyboard, so it can be applied to any terminal equipment, and the hand does not need to leave the basic key when editing, the most quick after the training operation. The Emacs style is more suitable for users of Unix than the vi-style computer. Bash, ksh, zsh use the following command to switch between Emacs and VI:

bash$ set-o Emacs

bash$ Set-o VI

Different commands are used in TCSH:

% bind Emacs

% Bind VI

You can also set a name for common commands and simplify user input, for example:

bash$ alias ec= "Echo This is a alias"

bash$ EC

This is a alias

Another capability that the shell uses to facilitate user operation is the ability to self-supplement commands or filenames, because the filenames under FreeBSD can be very long, and they all enter into a more troublesome situation. In fact, you can enter part of the name, and then press TAB (under the VI style to press ESC twice), the shell will automatically supplement the rest of the file name. If this part of the name that has already been entered does not confirm the command or file of the body, then the shell will only supplement the correct part, and then the user is notified to continue to enter the document with the correct documentation.

In fact, even under the basic SH or csh, you can use special characters such as "*" to simplify the input by pattern matching.

bash$ cd/usr/loca*

bash$ pwd

/usr/local

Many programs in Unix have the ability to handle pattern matching, while the shell's pattern matching function is most commonly used. The shell can use these special patterns to configure multiple files, to simplify the purpose of the operation. If you want to be familiar with UNIX, you must master the pattern matching.

When trying to enter Chinese characters under bash, in addition to having to set terminal properties to accept 8-bit characters (execute the stty pass8 command), you also need to set up bash's input and output conversion to include the following settings in the login profile file:

Bind ' Set Convert-meta off '

Bind ' Set Meta-flag on '

Bind ' Set Output-meta on '

Set-o VI Aix under shell

Related Article

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.