Question: I like Vi style of editing and I’m very comfortable with Vi commands. How do i use Vi style line editing in Unix command line?
Answer: Execute set -o vi at your Unix shell to enable Vi style editing.
Enable Vi Style Editing in BASH
$ set -o vi
By default the command line is in emacs mode.
After you perform set -o vi , press ESC to go to command mode. From here you can execute Vi command to perform any command line operation including the following:
- Go to the previous word in the command using b, and the next word using w.
- Use k to view previously executed command and j to view the next.
- Use 0 (Zero) to jump to start of the command. Use $ to go to the end of the command.
- Use /, n, N, fX to perform standard Vim search in command line.
- /search-chars which searches through the history and display the matching command that can be executed.
- Refer to Vi Editor Navigation Fundamental article to understand what Vi command can be used in the command line.
To make this change permanent set this option in bashrc.
$ cat ~/.bashrc set -o vi
Disable Vi Style Editing in BASH
Execute the following to revert back to emacs mode.
$ set -o emacs
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|






My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 1 comment… read it below or add one }
This just let me free forever, thank you so much!