Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




41.5.3 Shell History References

Various shells including csh and bash support history references that begin with ‘!’ and ‘^’. Shell mode recognizes these constructs, and can perform the history substitution for you.

If you insert a history reference and type <TAB>, this searches the input history for a matching command, performs substitution if necessary, and places the result in the buffer in place of the history reference. For example, you can fetch the most recent command beginning with ‘mv’ with ! m v <TAB>. You can edit the command if you wish, and then resubmit the command to the shell by typing <RET>.

Shell mode can optionally expand history references in the buffer when you send them to the shell. To request this, set the variable comint-input-autoexpand to input. You can make <SPC> perform history expansion by binding <SPC> to the command comint-magic-space.

Shell mode recognizes history references when they follow a prompt. See Shell Prompts, for how Shell mode recognizes prompts.

  Published under the terms of the GNU General Public License Design by Interspire