Use the previous command in Linux to reduce keyboard input

Source: Internet
Author: User

Using the previous command on a Linux terminal to reduce keyboard input and keyboard input can greatly improve the efficiency of programmers. The use of shortcut keys is a good example. Programmers often use terminals. Is there a similar "shortcut key" on the terminal that can improve our efficiency? The programmer's work is often related to the front and back. Therefore, this article demonstrates how to use the previous command to improve work efficiency. 1. Use all the parameter methods of the previous command :! * Example: If I edit hello.txtand bye.txt, I want to use git add to add these two files. You can use: git add! * 2. Use the last parameter method of the previous command :! $ ALT +. ESC +. The following two methods are provided. terminal will automatically complete 3. Use the methods except the last parameter in the previous command :! -: Example: I personally think this is useful, because some commands will input a lot of options, and the last one is the object that actually works. If you enter the option again, it will be troublesome. 4. Use any part of the method in the previous command: ALT + <num> +. The Nth part of the previous command indicated by num starts from 0 and is used for ls-shld hello.txt. ALT + 0 +. Is ls. 1 is-shld 5. replace one of the methods in the previous command: replace foo with bar ^ foo ^ bar with only one !! : Gs/foo/bar replace all 6. Previous command method :!!

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.